<script type="text/javascript" src="/js/clip/ZeroClipboard.js"></script> 
<link href="/admins/css/adminshare.css" rel="stylesheet" type="text/css" />
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >  
<script type="text/javascript">
    $(function() {
        window.alert = Boxy.alert;
        window.confirm = Boxy.confirm;
    });
</script>
<style>
    td .spic a{width:70px;height:70px;}
    .yundangk span.yubm a{color:#ce6c35}
    .indexa:hover{ text-decoration:underline;color:#f60;}
    .indexa:visited{color:red;}
</style>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action=""  method="get" style="margin:0px" id="form1">
            <div class="search">
                <div class="soubox">
                    <input type="text" id="quick" name="quick" value="<?php echo $this->quick ? $this->quick : ""; ?>"  placeholder="输入单号/仓库号/用户名等"/>
                    <input type="hidden" id="seltime" name="seltime" value="<?php echo $this->seltime ? $this->seltime : ""; ?>" />
                    <input type="hidden" id="starttime" name="starttime" value="<?php echo $this->starttime ? $this->starttime : ""; ?>"/>
                    <input type="hidden" id="endtime" name="endtime" value="<?php echo $this->endtime ? $this->endtime : ""; ?>" />
                    <input type="hidden" id="taobaoid" name="taobaoid" value="<?php echo $this->taobaoid ? $this->taobaoid : ""; ?>" />
                    <input type="hidden" id="taobaoname" name="taobaoname" value="<?php echo $this->taobaoname ? $this->taobaoname : ""; ?>" />
                    <input type="hidden" id="pagesize" name="pagesize" value="<?php echo $this->pagesize ? $this->pagesize : ""; ?>" />
                    <input type="hidden" id="operatorname" name="operatorname" value="<?php echo $this->operatorname ? $this->operatorname : ""; ?>" />
                </div>
                <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
            </div>
            <div class="timebox">
                <div class="ad_time">
                    <div class="timezdy seltimeElder" style="width: 90px;">
                        <div class="timeselect2 seltime" >
                            <span><?php echo $this->seltime ? ($this->seltime == "createdTime" ? "创建时间" : "付款时间") : "创建时间"; ?></span><i></i>
                        </div>
                        <div class="timeslelct_xl seltimeAll" style="display:none;" style="width: 90px;">
                            <ul>
                                <li><a href="javascript:void(0)" name='createdTime' class='setseltime'>创建时间</a></li>
                                <li><a href="javascript:void(0)" name='paidTime' class='setseltime'>付款时间</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="timefw">
                        <div class="time">
                            <div class="timeselect" style="width:100px;padding-left: 2px;" id="stime">
                                <span id="stimeval"><?php echo $this->starttime ? $this->starttime : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 90, date("Y"))); ?></span><i></i>
                            </div>
                            <div class="timeslelctbox"></div>
                        </div>
                        <div class="timezhi">
                            <span>至</span>
                        </div>
                        <div class="time">
                            <div class="timeselect" style="width:100px;padding-left: 2px;" id="etime">
                                <span id="etimeval"><?php echo $this->endtime ? $this->endtime : date("Y-m-d"); ?></span><i></i>
                            </div>
                            <div class="timeslelctbox"></div>
                        </div>
                    </div>
                    <div class="timezdy taobaonameElder" style="width: 90px;">
                        <div class="timeselect2 taobaoname" >
                            <span><?php echo $this->taobaoname ? $this->taobaoname : "购买帐号"; ?></span><i></i>
                        </div>
                        <div class="timeslelct_xl taobaonameAll" style="display:none;" style="width: 90px;">
                            <ul>
                                <li><a href="javascript:void(0)" name='0' class='settaobaoname'>所有</a></li>
                                <?php foreach ($this->taobaoAll as $taobaoVal) { ?>
                                    <li><a href="javascript:void(0)" name="<?php echo $taobaoVal->TaobaoSign; ?>" class='settaobaoname'><?php echo $taobaoVal->Taobaoname; ?></a></li>
                                <?php } ?> 
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="timeok">
                    <a href="javascript:$('#form1').submit();">确定</a>
                </div>
            </div>
            <div class="xianshi">
                <label>显示：</label>
                <ul>
                    <li <?php echo $this->pagesize ? ($this->pagesize == 10 ? 'class="xson"' : "") : 'class="xson"'; ?>><a href="javascript:void()" name='10' class='setpagesize'>10</a></li>
                    <li <?php echo $this->pagesize ? ($this->pagesize == 20 ? 'class="xson"' : "") : ""; ?>><a href="javascript:void()" name='20' class='setpagesize'>20</a></li>
                    <li <?php echo $this->pagesize ? ($this->pagesize == 30 ? 'class="xson"' : "") : ""; ?>><a href="javascript:void()" name='30' class='setpagesize'>30</a></li>
                </ul>
            </div>
        </form>
    </div>

</div>
<div class="biaoge">
    <div class="biaotbody">
        <table>
            <tr>
                <th class="li205">
            <div class="lijz"><input name="" type="checkbox" value=""></div>
            </th>
            <th class="li7">
            <div class="lileft">编号</div>
            </th>
            <th class="li60">
            <div class="lileft">商品标题</div>
            </th>
            <th class="li7">
            <div class="lijz">单价</div>
            </th>
            <th class="li5" >
            <div class="lijz">数量</div>
            </th>
            <th class="li7" >
            <div class="lijz">总价</div>
            </th>
            <th class="li5" >
            <div class="biaoxiala">
                <div class="lixiala">
                    <span>受理人</span>
                    <i></i>
                </div>
                <div class="biaoxllb" style="display:none;">
                    <ul>
                        <?php foreach ($this->adminuserAll as $adminuser) { ?>
                            <li><a href="javascript:void(0)" class="setoperator" name="<?php echo $adminuser->nikename; ?>"><?php echo $adminuser->nikename; ?></a></li>
                        <?php } ?>
                    </ul>
                </div>
            </div>
            </th>
            <th class="li9">
            <div class="lijz">状态</div>
            </th>
            </tr>
        </table>
    </div>
    <?php if ($this->operatorname) { ?>
        <div class="xzinfo">
            <ul>
                <?php if ($this->operatorname) { ?><li><div class="xzinfobox"><span><?php echo $this->operatorname; ?></span><a href="javascript:void(0)" title="撤销" class="removeset" i="operatorname"><i>撤销</i></a></div></li><?php } ?>
            </ul>
        </div>
    <?php } ?>
    <div class="table2">
        <?php
        if ($this->buydetail != '') {
            foreach ($this->buydetail as $Item) {
                $shopdetail = $Item->shipdetail;
                ?>
                <div class="tablebox">
                    <table>
                        <tr class="trhui">
                            <td class="li205">
                                <div class="lijz">
                                    <?php if ($Item->Status >= Application_Model_Order::STATUS_CONFRIM && $Item->Status != Application_Model_Order::STATUS_CANCEL && $Item->Isdelete != 1) { ?>
                                        <input name="MergerCheck" type="checkbox" id="MergerCheck<?php echo $Item->Id; ?>" value="<?php echo $Item->Id; ?>" />
                                    <?php } ?>
                                </div>
                            </td>
                            <td>
                                <div class="yundangk">
                                    <p>
                                        <span class="yubm"><a href="/admini/purchase/buydetail/id/<?php echo $Item->Id; ?>" class="indexa" target="_blank"><?php echo $Item->OrderNum; ?></a></span>
                                        <span><span style="padding-right: 2px;">标识：</span><a href="javascript:void(0)" class="soleNo"><?php echo $Item->SoleNo; ?></a></span>
                                        <?php if ($Item->Status == Application_Model_Order::STATUS_PAYING) { ?>
                                            <span>提交时间：<?php echo $Item->DateCreated; ?></span>
                                        <?php } else { ?>
                                            <span>付款时间：<?php echo $Item->datePaid; ?></span>
                                        <?php } ?>
                                        <span>最后处理时间：<?php echo $Item->dateConfrim; ?></span>
                                        <?php if (null !== $Item->consignTime) { ?>
                                            <span>发货时间：<?php echo $Item->consignTime; ?></span>
                                        <?php } ?>
                                        <span>仓库号：<a href="/admini/manageuser/userdetail/id/<?php echo $Item->userId; ?>" target="_blank" class="indexa"><?php echo 'F' . substr($Item->byuserdetail->storeno, 1); ?></a></span>
                                        <span><span style="padding-right: 2px;">用户名：</span><a href="javascript:void(0)" class="copyUserName"><?php echo $Item->user->nikename; ?></a>(<?php echo $Item->user->cityname ? $Item->user->cityname->Name : "未知"; ?>)</span>
                                        <span>邮件：<?php echo $Item->user->Email; ?></span>
                                    </p>
                                </div>
                                <div class="ydtishi iconShow<?php echo $Item->Id; ?>">
                                    <?php if ($Item->Isdelete != 1) { ?>
                                        <?php if ($Item->problem == Application_Model_Order::Problem_Default || $Item->problem == "" || $Item->problem == null) { ?>
                                            <a class="showProblem" href="javascript:void(0)" title="设置问题" style="background:url('/admins/images/icons/setProblem.ico');" name="<?php echo $Item->Id; ?>">设置问题</a>
                                        <?php } else if ($Item->problem == Application_Model_Order::Problem_Appear || $Item->problem == Application_Model_Order::Problem_User) { ?>
                                            <a class="ts3 showProblem" href="javascript:void(0)" title="问题包裹" name="<?php echo $Item->Id; ?>">问题包裹</a>
                                        <?php } else if ($Item->problem == Application_Model_Order::Problem_Complete) { ?>
                                            <a class="ts3_ showProblem" href="javascript:void(0)" title="问题解决" name="<?php echo $Item->Id; ?>">问题解决</a>
                                        <?php } ?>
                                        <a class="setDateShip" href="javascript:void(0)" title="预定订单" style="background:url('/admins/images/icons/dateShip.ico');" name="<?php echo $Item->Id; ?>">预定订单</a>
                                        <?php if ($Item->FinancialCheck) { ?>
                                            <a class="setHandwork" href="javascript:void(0)" title="手工处理" style="background:url('/admins/images/icons/yellow_money.png');" name="<?php echo $Item->Id; ?>">手工处理</a>
                                        <?php } else { ?>
                                            <a class="setHandwork" href="javascript:void(0)" title="手工处理" style="background:url('/admins/images/icons/blue_money.png');" name="<?php echo $Item->Id; ?>">手工处理</a>
                                        <?php } ?>
                                        <?php if ($Item->IsAbnormal == Application_Model_Order::Abnormal_Less || $Item->IsAbnormal == Application_Model_Order::Abnormal_Error || $Item->IsAbnormal == Application_Model_Order::Abnormal_Damage || $Item->Scheme == Application_Model_Order::Scheme_Reprocess) {
                                            ?>
                                            <a class="abnormalico" href="javascript:void(0)" title="异常代购" style="background:url('/admins/images/icons/yellow.ico');" name="<?php echo $Item->Id; ?>">异常代购</a>
                                        <?php } else if ($Item->IsAbnormal == Application_Model_Order::Abnormal_Solve) { ?>
                                            <a class="ts4 abnormalico" href="javascript:void(0)" title="异常解决"  name="<?php echo $Item->Id; ?>">异常解决</a>
                                        <?php } ?>
                                        <?php if ($Item->Status == Application_Model_Order::STATUS_OUTTIME_UNSEND || $Item->Status == Application_Model_Order::STATUS_OUTTIME_INSTORE) { ?>
                                            <a class="addLog" href="javascript:void(0)" title="添加催发记录" style="background:url('/admins/images/icons/add.ico');"  name="<?php echo $Item->Id; ?>">添加催发记录</a>
                                        <?php } ?>
                                        <?php if ($Item->IsTodo) { ?>
                                            <a class="ts4 addTodo" href="javascript:void(0)" title="已有待办事项"  style="background:url('/admins/images/icons/todo2.ico');" name="<?php echo $Item->Id; ?>">已有待办事项</a>
                                        <?php } else { ?>
                                            <a class="ts4 addTodo" href="javascript:void(0)" title="添加待办"  style="background:url('/admins/images/icons/todo.ico');" name="<?php echo $Item->Id; ?>">添加待办</a>
                                            <a class="addLog" href="javascript:void(0)" title="添加日志" name="<?php echo $Item->Id ?>" style="background:url('/admins/images/icons/add.ico');float: left;height: 16px;width: 16px;text-indent: -100000px;display: inline;margin-left: 10px;" >添加日志</a>
                                        <?php } ?>
                                    <?php } ?>
                                </div>
                            </td>
                            <td style="width:150px;text-align:center;" class="setStatusName<?php echo $Item->Id; ?>">
                                <?php
                                if ($Item->scheme >= Application_Model_Order::Scheme_Return && $Item->scheme != Application_Model_Order::Scheme_Reprocess && $Item->scheme != Application_Model_Order::Scheme_Renormal) {
  
                                    ?>
                                    <?php if($Item->rechangeStatus == Application_Model_Order::ReChange_Reissue): ?>
                                    <a href="javascript:void(0)" name="<?php echo $Item->Id; ?>" class="indexa setSchemeComplete <?php echo $Item->ReverseStatus["fun"]; ?>">
                                        <div>设置完成</div>
                                    </a>
                                    <?php endif; ?>
                                <?php } else {
                                    ?>
                                    <a href="javascript:void(0)" name="<?php echo $Item->Id; ?>" class="indexa <?php echo $Item->ReverseStatus["fun"]; ?>">
                                        <div><?php echo $Item->ReverseStatus["name"]; ?></div>
                                    </a>
                                <?php } ?>
                            </td>
                        </tr>
                        <tr <?php echo $Item->user->remark ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                                <?php echo $Item->user->remark ? ("用户备注：" . (mb_strlen($Item->user->remark, 'utf-8') > 20 ? (mb_substr($Item->user->remark, 0, 20, 'utf-8') . '......') : $Item->user->remark)) : ""; ?>
                            </td>
                        </tr>
                        <?php $setting = Application_Model_ServiceSetting::getByInfo($Item->user->id,Application_Model_ServiceSetting::Type_Order); ?>
                        <tr <?php echo $setting ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;">
                                <?php foreach($setting as $_set){
                                    $str = '';
                                    if($_set->setting == 1){
                                        $mom = '';
                                        if($_set->value == 1){
                                            $mon = '10元以内';
                                        }elseif($_set->value == 2){
                                            $mon = '20元以内';
                                        }elseif($_set->value == 3){
                                            $mon = '30元以内';
                                        }elseif($_set->value == 4){
                                            $mon = '50元以内';
                                        }elseif($_set->value == 5){
                                            $mon = '100元以内';
                                        }elseif($_set->value == 6){
                                            $mon = '不设限';
                                        }
                                        if($_set->option == 1){
                                            $str = "授权悠奇在我选定的金额内进行余额扣款：$mon";
                                        }elseif($_set->option == 2){
                                            $str = '直接取消代购订单并退款';
                                        }elseif($_set->option == 3){
                                            $str = '提示我，48小时无回复自动取消并退款';
                                        }
                                        echo "为您代购商品时运费上升或价格上涨希望悠奇如何操作？用户标记：$str<br/>";
                                    }elseif($_set->setting == 2){
                                        if($_set->option == 1){
                                            $str = '代购有货的部分商品，缺货（或少货）的部分退款给我';
                                        }elseif($_set->option == 2){
                                            $str = '直接取消此代购订单并退款';
                                        }elseif($_set->option == 3){
                                            $str = '提示我，48小时无回复自动购买有货的部分';
                                        }
                                        echo "代购订单部分商品缺货（或少货）希望悠奇如何操作？用户标记：$str";
                                    }
                                } ?>
                            </td>
                        </tr>

                        <tr <?php echo in_array($Item->userId,$this->OrderPay) ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               风险审核：暂停此用户的所有服务！
                            </td>
                        </tr>
                         <tr <?php echo in_array($Item->user->id,$this->paypalBill) ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               客户第一次国际信用卡支付，24小时风险审核后自动解除服务限制！
                            </td>
                        </tr>

                        <tr>
                            <td colspan="3" style="padding:0">
                                <table>
                                    <?php
                                    echo "<tr id='tr_" . $Item->Id . "_1'>";
                                    $index = 2;
                                    $shipUrl = "";
                                    ?>
                                    <?php
                                    foreach ($shopdetail as $key => $val) {
                                        if (count($shopdetail) > 1) {
                                            if ($key > 0) {
                                                echo "<tr id='tr_" . $Item->Id . "_$index'>";
                                                $index+=1;
                                            }
                                        }
                                        $productd = $val->byproductd;         
                                        if ($key == 0) {
                                            $shipUrl = $productd->url;
                                        }
                                        $image = $productd->image ? $productd->image : $productd->remoteImage;
                                        $arrimage = explode('"', $image);
                                        $imgUrl = "javascript:void(0)";
                                        if (count($arrimage) > 1) {
                                            $imgUrl = $arrimage[1];
                                        } else {
                                            $imgUrl = $image;
                                        }
                                        if (strpos($shipUrl, "taobao") > 0 || strpos($shipUrl, "tmall") > 0) {
                                            $extendUrl = 'http://trade.taobao.com/trade/detail/trade_item_detail.htm?spm=a1z09.2.9.27.yegbD7&bizOrderId=' . $Item->procureNo;
                                        } else {
                                            $extendUrl = $shipUrl;
                                        }
                                        ?>
                                        <td class="li205">
                                            <?php if ($Item->Isdelete != 1 && $val->Status != Application_Model_OrderItem::Status_Refund) { ?>
                                                <div class="lijz">
                                                    <input name="SplitCheck" type="checkbox" id="SplitCheck<?php echo $val->Id; ?>" value="<?php echo $val->Id; ?>" class="<?php echo $Item->Id; ?>" />
                                                </div>
                                            <?php } ?>
                                        </td>
                                        <td class="li7">
                                            <div class="spic" style="margin-top: 15px;margin-right: 10px;"><?php echo $key + 1; ?></div>
                                            <?php if ($Item->status != Application_Model_Order::STATUS_PAYING && $Item->status != Application_Model_Order::STATUS_PAID && $Item->status != Application_Model_Order::STATUS_CANCEL) { ?>
                                                <?php if ($Item->status == Application_Model_Order::STATUS_CONFRIM && $Item->operator != Uuch_Util::getUserNikeName()) { ?>
                                                    <div><img src="<?php echo $imgUrl; ?>" width="50px" height="50px" style="vertical-align:middle;"/></div>
                                                <?php } else { ?>
                                                    <div>
                                                        <a isconvert="1" href="<?php echo $productd->url; ?>" target="_blank">
                                                            <img src="<?php echo $imgUrl; ?>" width="50px" height="50px" style="vertical-align:middle;"/>
                                                        </a>
                                                    </div>
                                                <?php } ?>
                                            <?php } else { ?>
                                                <div><img src="<?php echo $imgUrl; ?>" width="50px" height="50px" style="vertical-align:middle;"/></div>
                                            <?php } ?>

                                        </td>
                                        <td class="li60">
                                            <?php if ($Item->status != Application_Model_Order::STATUS_PAYING && $Item->status != Application_Model_Order::STATUS_PAID && $Item->status != Application_Model_Order::STATUS_CANCEL) { ?>
                                                <?php if ($Item->status == Application_Model_Order::STATUS_CONFRIM && $Item->operator != Uuch_Util::getUserNikeName()) { ?>
                                                    <div style="float:left;"><?php echo $val->productName; ?></div><br>                                                    
                                                    <div style="float:left;color:#666;"><?php echo Application_Model_Product::parsePropertyAlias($productd->PropertyAlias); ?></div>
                                                <?php } else { ?>
                                                    <div style="float:left;">
                                                        <a isconvert="1" onclick="this.style.color='red'" href="<?php echo $val->taoBaoUrl ? $val->taoBaoUrl : $productd->url; ?>" target="_blank" class="indexa"><?php echo $val->productName; ?></a>
                                                    </div><br>
                                                    <div style="float:left;color:#666;"><a href="<?php echo $productd->url ?>" target="_blank"><?php echo Application_Model_Product::parsePropertyAlias($productd->PropertyAlias); ?></a></div>
                                                <?php } ?>
                                            <?php } else { ?>
                                                <div style="float:left;"><?php echo $val->productName; ?></div><br>
                                                <div style="float:left;color:#666;"><?php echo Application_Model_Product::parsePropertyAlias($productd->PropertyAlias); ?></div>
                                            <?php } ?>
                                            <div style="float:left;color:#666;width: 970px;">商品备注：<?php echo $val->comment ? $val->comment : "(无)"; ?></div><br>
                                            <div class="ydtishi" style="width: 15px;height: 15px;float: left;"><a class="ts1 addRemark" href="javascript:void(0)" title="添加备注" name="<?php echo $val->Id; ?>">添加备注</a></div>
                                            <div style="float:left;color:#c00;margin:3px 0 0 10px;width: 900px;" id="itemDescription<?php echo $val->id; ?>"><?php echo $val->description ? $val->description : ""; ?></div>
                                        </td>
                                        <td class="li7" id="returnMoney<?php echo $val->id; ?>">
                                            <div class="lijz">
                                                <p>￥<span><?php echo $val->price; ?></span></p>
                                                <?php if ($val->status == Application_Model_OrderItem::Status_Refund) { ?>
                                                    <div><font color="green">已退款</font></div>
                                                <?php } else if ($val->status == Application_Model_OrderItem::Status_Less) { ?>
                                                    <div><font color="green">少货<br>
                                                        <?php echo ($Item->scheme == Application_Model_Order::Scheme_ReturnMoney ? ($Item->rechangeStatus == Application_Model_Order::ReChange_Complete ? "已退款" : "等待退款") : ""); ?>
                                                        </font></div>
                                                <?php } else if ($val->status == Application_Model_OrderItem::Status_Error) { ?>
                                                    <div><font color="green">发错货</font></div>
                                                    <?php
                                                } else {
                                                    if ($Item->status != Application_Model_Order::STATUS_CANCEL && $Item->status != Application_Model_Order::STATUS_INSTORE && $Item->status != Application_Model_Order::STATUS_PAYING && $Item->status != Application_Model_Order::STATUS_PAID && count($Item->shipdetail) > 1) {
                                                        if ($Item->status == Application_Model_Order::STATUS_CONFRIM && $Item->operator == Uuch_Util::getUserNikeName()) {
                                                            ?>
                                                            <a href="javascript:void(0)"  class="indexa SingleRetuenMoney" name="<?php echo $val->id; ?>" i="<?php echo $Item->Id; ?>">
                                                                <div id="SingleRetuenMoney<?php echo $val->id; ?>">单项退款</div></a>
                                                        <?php } else if ($Item->status != Application_Model_Order::STATUS_CONFRIM) { ?>
                                                            <a href="javascript:void(0)"  class="indexa SingleRetuenMoney" name="<?php echo $val->id; ?>" i="<?php echo $Item->Id; ?>">
                                                                <div id="SingleRetuenMoney<?php echo $val->id; ?>">单项退款</div></a> 
                                                            <?php
                                                        }
                                                    }
                                                }
                                                ?>
                                            </div>
                                        </td>
                                        <td class="li5">
                                            <div class="lijz quantity<?php echo $val->id; ?>"><?php echo $val->quantity; ?></div>
                                        </td>
                                        <?php if ($key == 0) { ?>
                                            <td class="li9" rowspan="<?php echo count($Item->shipdetail); ?>" style="border-left: #d4dae2 solid 1px;">
                                                <div class="lijz">
                                                    ￥<span style="font-size:16px;color:#f00"><?php echo $Item->sum; ?> </span>
                                                    <?php if ((int) ($Item->shipFee) > 0) { ?>
                                                        <p>（运费：+<?php echo $Item->shipFee ?>元）</p>
                                                    <?php } ?>
                                                    <?php if ((int) ($Item->discount) > 0) { ?>
                                                        <p>（优惠券：-<?php echo $Item->discount; ?>元）</p>
                                                    <?php } ?>
                                                    <p>共<span style="color:#005AA0;font-weight:bold"> <?php echo $Item->SunOrder ?> </span>件</p>
                                                </div>
                                            </td>
                                            <td class="li5" rowspan="<?php echo count($Item->shipdetail); ?>" style="border-left: #d4dae2 solid 1px;">
                                                <div class="lijz">
                                                    <?php echo $Item->operator ? $Item->operator : "暂无"; ?>
                                                    <?php if ($Item->Status != Application_Model_Order::STATUS_PAID && $Item->Isdelete != 1 && $Item->Status != Application_Model_Order::STATUS_CANCEL && $Item->operator != Uuch_Util::getUserNikeName()) { ?>
                                                        <p><a href="javascript:void(0)" id="editOperator<?php echo $Item->id ?>" class="indexa editOperator" name="<?php echo $Item->id ?>">更改受理人</a></p>
                                                    <?php } ?>
                                                </div>
                                            </td>
                                            <td class="li9" rowspan="<?php echo count($Item->shipdetail); ?>" style="border-left: #d4dae2 solid 1px;">
                                                <div class="lijz getStatusName<?php echo $Item->id ?>">
                                                    <?php if ($Item->Isdelete != 1) { ?>
                                                        <?php if ($Item->isAbnormal == Application_Model_Order::Abnormal_Less) { ?>
                                                            <div>部分入库</div>
                                                        <?php } else if ($Item->isAbnormal == Application_Model_Order::Abnormal_Error) { ?>
                                                            <div>错误包裹</div>
                                                        <?php } else { ?>
                                                            <?php if ($Item->scheme == Application_Model_Order::Scheme_Return) { ?>
                                                                <div><?php echo $Item->rechangeStatus == Application_Model_Order::ReChange_Complete ? "退货完成" : "退货中"; ?></div>
                                                            <?php } else if ($Item->scheme == Application_Model_Order::Scheme_Change) { ?>
                                                                <div><?php echo $Item->rechangeStatus == Application_Model_Order::ReChange_Complete ? "换货完成" : "换货中"; ?></div>
                                                            <?php } else if ($Item->scheme == Application_Model_Order::Scheme_Reissue) { ?>
                                                                <div><?php echo $Item->rechangeStatus == Application_Model_Order::ReChange_Complete ? "补发完成" : "补发中"; ?></div>
                                                            <?php } else if ($Item->scheme == Application_Model_Order::Scheme_ReturnMoney) { ?>
                                                                <div><?php echo $Item->rechangeStatus == Application_Model_Order::ReChange_Complete ? "退款完成" : "退款中"; ?></div>
                                                            <?php } else { ?>
                                                                <div id="statesname<?php echo $Item->id ?>" style="color:#229000;"><?php echo $Item->StatusNames; ?></div>
                                                                <?php
                                                                if ($Item->status != Application_Model_Order::STATUS_BANK) {
                                                                    if ($Item->status != Application_Model_Order::STATUS_CANCEL && $Item->status != Application_Model_Order::STATUS_INSTORE && $Item->status != Application_Model_Order::STATUS_PAYING && $Item->status != Application_Model_Order::STATUS_PAID) {
                                                                        ?>
                                                                        <p><a href="javascript:void(0)" class="indexa cancel" name="<?php echo $Item->Id; ?>">取消并退款</a></p>
                                                                        <?php
                                                                    }
                                                                }
                                                                ?>
                                                                <?php
                                                            }
                                                        }
                                                        ?>          
                                                    <?php } else { ?>
                                                        <div id="statesname<?php echo $Item->id ?>" style="color:#C00;">已删除</div>
                                                    <?php } ?>
                                                </div>
                                            </td>
                                </tr>
                                <?php
                            }
                        }
                        ?> 
                    </table>
                    </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <div class="yubm"style="float:left;">
                                <span> 订单号：<input type="textbox" id="procureNo<?php echo $Item->id ?>" name="procureNo<?php echo $Item->id ?>" value="<?php echo $Item->procureNo; ?>" style="width:220px" /></span>&nbsp;&nbsp;&nbsp;
                                <span>物流：</span><select name="logistics<?php echo $Item->id ?>" id="logistics<?php echo $Item->id ?>">
                                    <option value="" ></option>
                                    <?php foreach ($this->expresscomp as $expresscomp) { ?>
                                        <option value="<?php echo $expresscomp->id; ?>" <?php
                                        if ($expresscomp->id == $Item->logistics) {
                                            echo "selected";
                                        }
                                        ?>><?php echo $expresscomp->word . '_' . $expresscomp->name; ?></option>
                                            <?php } ?>
                                </select>
                                <input type="logisticsNo" id="logisticsNo<?php echo $Item->id ?>" name="logisticsNo<?php echo $Item->id ?>" value="<?php echo $Item->logisticsNo; ?>" />&nbsp;&nbsp;
                                <input type="button" class="btnLogistics" value="  更  新  " name="<?php echo $Item->id ?>" id="btnLogistics<?php echo $Item->id ?>" />
                                <?php if ($Item->procureNo) { ?>
                                    <span class="yubm" style="margin-left: 20px;"><a href="<?php echo $extendUrl; ?>" target="_block" class="indexa">跟踪到：<?php echo $Item->TaoBao ? $Item->TaoBao->taobaoname : "订单跟踪"; ?></a></span>
                                <?php } ?>
                                <?php if ($Item->status == Application_Model_Order::STATUS_SELLER_SENDED || $Item->status == Application_Model_Order::STATUS_INSTORE || $Item->status == Application_Model_Order::STATUS_OUTTIME_INSTORE) { ?>
                                    <span class="yubm" style="margin-left: 20px;"><a href="javascript:void(0)" class="indexa traceLogistics" name="<?php echo $Item->Id; ?>">物流信息</a></span>
                                <?php } ?>
                                <?php if ($Item->Scheme == Application_Model_Order::Scheme_Return || $Item->Scheme == Application_Model_Order::Scheme_Change) { ?>
                                    <span class="yubm" style="margin-left: 20px;"><a href="javascript:void(0)" class="indexa orderReturnChange" name="<?php echo $Item->Id; ?>">退换货</a></span>
                                <?php } else if ($Item->Scheme == Application_Model_Order::Scheme_Reissue) { ?>
                                    <?php
                                    $orderReissue = $Item->getTrackInfo(Application_Model_Tracking::Type_ReissueLogistics);
                                    if ($orderReissue) {
                                        ?>
                                    <span class="yubm" style="margin-left: 20px;"><a href="javascript:void(0)" class="indexa orderReissue" name="<?php echo $Item->Id; ?>">补发</a><span>(<?php echo $orderReissue->ShipItem->Name . ":" . $orderReissue->Content; ?>)</span></span>
                                    <?php } else { ?>
                                        <span class="yubm" style="margin-left: 20px;"><a href="javascript:void(0)" class="indexa orderReissue" name="<?php echo $Item->Id; ?>">补发</a></span>
                                    <?php } ?>
                                <?php } else if ($Item->Scheme == Application_Model_Order::Scheme_ReturnMoney) { ?>
                                    <span class="yubm" style="margin-left: 20px;"><a href="javascript:void(0)" class="indexa orderReturnChange" name="<?php echo $Item->Id; ?>">单项退款</a></span>   
                                <?php } ?>
                            </div>

                        </td>
                        <td>
                            <?php if ($Item->Status == Application_Model_Order::STATUS_SUBSCRIBE && $Item->dateShip != "") { ?>
                                预计发货时间：<?php echo $Item->dateShip; ?>
                            <?php } ?>
                        </td>
                    </tr>
                    </table>
                </div>
                <?php
            }
        }
        ?>
    </div>
</div>
<div style="height:140px;">&nbsp;</div>
<div class="toolbar" style="position:fixed;bottom:0px;background-color:#fff;width: 90%;">
    <div class="qunx">
        <ul>
            <li><a class="indexa clearSelected" href="javascript:void(0)"><span>清除已选</span></a></li>
            <li><a class="anvbotton SplitOrder" href="javascript:void(0)"><span>拆分订单</span></a></li>
            <li><a class="anvbotton4 MergerOrder" href="javascript:void(0)"><span>合并所选</span></a></li>
        </ul>
    </div>
    <div class="Page">
        <?php
        echo $this->partial('paging.phtml', array("pages" => $this->result, "pamas" => "quick=" . $this->quick . "&seltime=$this->seltime&starttime=$this->starttime&endtime=$this->endtime&taobaoid=$this->taobaoid&taobaoname=$this->taobaoname&pagesize=$this->pagesize&operatorname=$this->operatorname"));
        ?>
    </div>
</div>
<style>
    .bColor{background-color: #b6c4d8 ;}
    .abnormalTr{border-bottom: #c00 solid 1px;}
</style>
<div class="tanchuang" style="display:none;width: 760px;height: 540px;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">订单操作</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
        <div class="wt_nav">
            <ul>
                <li class="wt_on"><a href="javascript:void(0)" id="splitOrderTitle">订单拆分</a></li>
                <li><a href="javascript:void(0)" id="reserveOrderTitle">订单预订</a></li>
                <li><a href="javascript:void(0)" id="isProblemTitle">订单问题</a></li>
                <li><a href="javascript:void(0)" id="addRemarkTitle">添加备注</a></li>
                <li><a href="javascript:void(0)" id="handworkTitle">手工处理</a></li>
                <li><a href="javascript:void(0)" id="abnormalTitle">异常处理</a></li>
                <li><a href="javascript:void(0)" id="lossTitle">损耗登记</a></li>
                <li><a href="javascript:void(0)" id="addLogTitle">添加日志</a></li>
                <li><a href="javascript:void(0)" id="addTodoTitle">添加待办</a></li>
                <li><a href="javascript:void(0)" id="traceTitle">物流跟踪</a></li>
                <li><a href="javascript:void(0)" id="returnChangeOrderTitle">代购退换货</a></li>
                <li><a href="javascript:void(0)" id="orderReissueTitle">代购补发</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box" id="splitOrderConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>

                <tr class='content_bottom'>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 200px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subSplitOrder"><span>确认</span></a>
                        </div>
                        <div class="" style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="returnChangeOrderConent" style="display: none;">
        <div class="wt_center" style="height:390px;margin: 10px 10px 5px 10px;overflow: auto;">
            <div class="wt_type wt_reContent" style="padding: 10px 0px 5px 0px;width: 95%;display: none;">
                退换货地址：
            </div>
            <div class="wt_caozuo wt_addAddress wt_reContent" style="width:680px;margin: 0px 0px;display: none;">
                <textarea name="addressReturnChange" cols="" rows="" id="addressReturnChange" style="width:560px;"></textarea>
                <a class="wt_liuyan" id="subreturnChangeAddress" href="javascript:void(0);"><span>添加</span></a>
            </div>
            <div class="wt_reChangeLogistics wt_reContent" style="width:680px;border-bottom: #c00 solid 1px;display: none;">
                <table style="width: 98%">
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width:11%;" rowspan="3">发货信息：</td>
                        <td style="width:18%;text-align: right;padding-right: 5px;">发货渠道：</td>
                        <td style="padding-left: 4px;width:50%;" class="w0"><select name="reChangeLogistics" id="reChangeLogistics">
                                <?php foreach ($this->expresscomp as $expresscomp) { ?>
                                    <option value="<?php echo $expresscomp->id; ?>" <?php
                                    if ($expresscomp->id == $Item->logistics) {
                                        echo "selected";
                                    }
                                    ?>><?php echo $expresscomp->word . '_' . $expresscomp->name; ?></option>
                                        <?php } ?>
                            </select></td>
                        <td rowspan="3">
                            <a class="anvbotton subReChangeLogistics" href="javascript:void(0)"><span>提交</span></a>
                        </td>
                    </tr>
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width: 18%;text-align: right;padding-right: 5px;">发货单号：</td>
                        <td style="padding-left: 5px;" class="w0">
                            <input type="text" id="reChangeLogisticsNo" name="reChangeLogisticsNo" value="" /></td>
                    </tr>
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width: 18%;text-align: right;padding-right: 5px;">发货运费：</td>
                        <td style="padding-left: 5px;" class="w0">
                            <input type="text" id="reChangeLogisticsMoney" name="reChangeLogisticsMoney" value="" />元</td>
                    </tr>
                </table>
            </div>
            <div class="wt_reChangeMoney wt_reContent" style="width:680px;border-bottom: #c00 solid 1px;display: none;">
                <table style="width: 98%">
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width: 18%;text-align: right;padding-right: 5px;">退款：</td>
                        <td style="padding-left: 5px;" class="w0">
                            <input type="text" id="reChangeMoney" name="reChangeMoney" value="" />元</td>
                        <td rowspan="3"><a class="anvbotton subReChangeMoney" href="javascript:void(0)"><span>提交</span></a></td>
                    </tr>
                </table>
            </div>
            <div class="wt_reissueLogistics wt_reContent" style="width:680px;border-bottom: #c00 solid 1px;display: none;">
                <table style="width: 98%">
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width:11%;" rowspan="3">收货信息：</td>
                        <td style="width:18%;text-align: right;padding-right: 5px;">收货渠道：</td>
                        <td style="padding-left: 4px;width:50%;" class="w0"><select name="orderReissueLogistics" id="orderReissueLogistics">
                                <?php foreach ($this->expresscomp as $expresscomp) { ?>
                                    <option value="<?php echo $expresscomp->id; ?>" <?php
                                    if ($expresscomp->id == $Item->logistics) {
                                        echo "selected";
                                    }
                                    ?>><?php echo $expresscomp->word . '_' . $expresscomp->name; ?></option>
                                        <?php } ?>
                            </select></td>
                        <td rowspan="3"><a class="anvbotton subReissueLogisticsNo" href="javascript:void(0)"><span>提交</span></a></td>
                    </tr>
                    <tr class='content_bottom' style="height:30px;">
                        <td style="width: 18%;text-align: right;padding-right: 5px;">收货单号：</td>
                        <td style="padding-left: 5px;" class="w0">
                            <input type="text" id="orderReissueLogisticsNo" name="orderReissueLogisticsNo" value="" /></td>
                    </tr>
                </table>
            </div>
        </div>

    </div>
    <div class="wenti_box" id="orderReissueContent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr class='content_bottom'>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">补发渠道：</td>
                    <td style="width: 420px;" class="w0"><select name="reissueLogistics" id="reissueLogistics">
                            <?php foreach ($this->expresscomp as $expresscomp) { ?>
                                <option value="<?php echo $expresscomp->id; ?>" <?php
                                if ($expresscomp->id == $Item->logistics) {
                                    echo "selected";
                                }
                                ?>><?php echo $expresscomp->word . '_' . $expresscomp->name; ?></option>
                                    <?php } ?>
                        </select></td>
                </tr>
                <tr class='content_bottom'>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">补发物流：</td>
                    <td style="width: 420px;" class="w0">
                        <input type="text" id="reissueLogisticsNo" name="reissueLogisticsNo" value="" /></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 100px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subReissueOrder"><span>确认</span></a>
                        </div>
                        <div class="" style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="reserveOrderConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">预订时间：</td>
                    <td style="width: 420px;" class="w0"><input type="text" id="reserveTime" name="reserveTime" value="" onClick="WdatePicker()"  readonly/></td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">预订原因：</td>
                    <td style="width: 420px;" class="w0"><textarea id="reserveCause" name="reserveCause" style="width:390px;height: 60px;"></textarea></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subReserveOrder"><span>确认</span></a>
                        </div>
                        <div  style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="traceConent" style="display: none;">
        <div class="wt_center table" style="width:700px;height: 390px;overflow: auto;">
            <div class="loading" style="">
                <p>正在获取物流信息…</p>
            </div>
        </div>
    </div>
    <div class="wenti_box" id="handworkConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">类型：</td>
                    <td style="width: 420px;" class="w0">
                        <select id="hendworkType" name="hendworkType">
                            <option value="<?php echo Application_Model_FinancialCheckItem::Money_Need; ?>">扣款</option>
                            <option value="<?php echo Application_Model_FinancialCheckItem::Money_Add; ?>">充值</option>
                        </select></td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">金额：</td>
                    <td style="width: 420px;" class="w0"><input type="text" id="handworkMoney" name="handworkMoney" value=""/>元</td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">财务交易类型：</td>
                    <td style="width: 420px;" class="w0">
                        <select name="businessType" id="businessType">
                            <option value="spbj">商品补交</option>
                            <option value="yfbj">运费补交</option>
                            <option value="spjztk">商品价值退款</option>
                            <option value="yftk">运费退款</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">原因：</td>
                    <td style="width: 420px;" class="w0"><textarea id="handworkReason" name="handworkReason" style="width:390px;height: 60px;"></textarea></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subHandworkr"><span>确认</span></a>
                        </div>
                        <div  style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="checkHistory" style="width: 93%;float: left;margin-left: 50px;">

                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="isProblemConent" style="display: none;">
        <div class="wt_center" style="height:300px;">

        </div>
        <div style="margin-left:20px;margin-top: -5px;margin-bottom: 5px;">
            <span>
                <input type="checkbox" onclick="repayHandle(this)" value="0" name="repay" id="repay">补交金额:
                <input type="text" name="repaysum" readonly="" id="repay-sum" style="width:50px" value="">
            </span>
        </div>
        <div class="wt_caozuo" style="width:738px;">
            <textarea name="content" cols="" rows="" id="content" style="width:670px;"></textarea>
            <input type="hidden" id="orderProblemId" name="orderProblemId" value="" />
            <a class="wt_liuyan" id="subIsProblem" href="javascript:void(0);"><span>留言</span></a>
        </div>
        <a class="indexa SolveComplete" href="javascript:void(0);" style="float:right;margin-right: 20px;padding: 8px;"><span>问题解决</span></a>
    </div>
    <div class="wenti_box" id="addRemarkConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr>
                    <td style="width: 120px;text-align: right;padding-right: 20px;">悠奇备注：</td>
                    <td style="width: 420px;" class="w0">
                        <textarea id="remark" name="remark" style="width:390px;height: 60px;"></textarea>
                    </td>
                </tr>
                <tr class='content_bottom'>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 200px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subAddRemark"><span>确认</span></a>
                        </div>
                        <div  style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)"  class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="abnormalConent" style="display: none;">
        <div class="wt_center" style="height:300px;margin: 10px 10px 5px 10px;">

        </div>
        <div class="wt_type" style="height:60px;width: 100%;display: none;">
            <ul>
                <li style="float: left;width: 70px;padding: 5px 0;margin-left: 10px;">
                    <label>处理类型：</label></li>
                <li style="float: left;width: 90px;padding: 5px 0;">
                    <label><input id="isAbnormal1" name="isAbnormal" class="disposeType" type="radio" value="0" checked="checked">协商中</label></li>
                <li style="float: left;width: 90px;padding: 5px 0;">
                    <label><input id="isAbnormal2" name="isAbnormal" class="disposeType" type="radio" value="1">协商完</label></li>
                <li style="clear:both;width: 100%; height: 0px;overflow: hidden;"></li>


            </ul>
            <ul>
                <li style="float: left;width: 70px;padding: 5px 5px 5px 0;display: none;text-align: right;" class="scheme">
                    <label>协商方案：</label></li>
                <li style="float: left;width: 60px;padding: 5px 0;display: none;" class="scheme">
                    <label><input id="scheme3" name="abnormalScheme" type="radio" value="<?php echo Application_Model_Order::Scheme_Reissue; ?>" checked="checked">补发</label></li>
                <li style="float: left;width: 60px;padding: 5px 0;display: none;" class="scheme">
                    <label><input id="scheme1" name="abnormalScheme" type="radio" value="<?php echo Application_Model_Order::Scheme_Return; ?>">退货</label></li>
                <li style="float: left;width: 60px;padding: 5px 0;display: none;" class="scheme">
                    <label><input id="scheme2" name="abnormalScheme" type="radio" value="<?php echo Application_Model_Order::Scheme_Change; ?>">换货</label></li>
                <li style="float: left;width: 80px;padding: 5px 0;display: none;" class="scheme">
                    <label><input id="scheme4" name="abnormalScheme" type="radio" value="<?php echo Application_Model_Order::Scheme_ReturnMoney; ?>">单项退款</label></li>
                <li style="float: left;width: 80px;padding: 5px 0;display: none;" class="scheme">
                    <label><input id="scheme5" name="abnormalScheme" type="radio" value="<?php echo Application_Model_Order::Scheme_Renormal; ?>">恢复正常</label></li>
                <li style="float: right;width: 120px;margin-top: 10px;margin-right: 10px;">
                    <a class="indexa loss" href="javascript:void(0);"><span>登记代购人员出错</span></a></li>
                <li style="clear:both;width: 100%; height: 0px;overflow: hidden;"></li>
            </ul>
        </div>
        <div class="wt_caozuo" style="width:738px;display: none;">
            <textarea name="abnormalCause" cols="" rows="" id="abnormalCause" style="width:670px;"></textarea>
            <input type="hidden" id="abnormalId" name="abnormalId" value="" />
            <a class="wt_liuyan" id="subAbnormal" href="javascript:void(0);"><span>留言</span></a>
        </div>
    </div>
    <div class="wenti_box" id="addLogConent" style="display: none;">
        <div class="wt_center table" style="width:700px;height: 390px;">
            <table>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">时间：</td>
                    <td style="width: 420px;" class="w0"><input type="text" id="addLogTime" name="addLogTime" value=""  /></td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">日志内容：</td>
                    <td style="width: 420px;" class="w0">
                        <textarea id="addLogContent" name="addLogContent" style="width:390px;height: 60px;"></textarea></td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">用户是否可见：</td>
                    <td style="width: 420px;" class="w0">
                        <select id="logIsVisible" name="logIsVisible">
                            <?php foreach ($this->userVisible as $visibleKey => $visibleVal) { ?>
                                <option value="<?php echo $visibleKey; ?>"><?php echo $visibleVal; ?></option>
                            <?php } ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subAddLog"><span>确认</span></a>
                        </div>
                        <div class="nui-btn " style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)"  class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <div class="operatelog" style="width: 93%;float: left;margin-left: 50px;height: 145px;overflow: auto;">

            </div>
        </div>
    </div>
    <div class="wenti_box" id="lossConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">下单人：</td>
                    <td style="width: 420px;" class="w0"><input type="text" id="lossUser" name="lossUser" value=""  readonly/></td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">金额：</td>
                    <td style="width: 420px;" class="w0"><input type="text" id="lossMoney" name="lossMoney" value=""/>元</td>
                </tr>
                <tr>
                    <td style="width: 180px;text-align: right;padding-right: 20px;">原因：</td>
                    <td style="width: 420px;" class="w0"><textarea id="lossReason" name="lossReason" style="width:390px;height: 60px;"></textarea></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                            <a class="anvbotton5" href="javascript:void(0)" id="subLost"><span>确认</span></a>
                        </div>
                        <div  style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="checkHistory" style="width: 93%;float: left;margin-left: 50px;">

                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="wenti_box" id="addTodoConent" style="display: none;">
        <div class="wt_center table" style="width:700px;">
            <iframe src="" id="addTodoIframe" width="100%" frameborder="no" border="0" framespacing="0" scrolling="no" noresize="noresize" height="480px"></iframe>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;">
    <input type="hidden" id="orderId" name="orderId" value="" />
    <input type="hidden" id="qualityId" name="qualityId" value="" />
</div>
<script>
    $(function() {
        $.fn.numeral = function() {
            $(this).css("ime-mode", "disabled");
            this.bind("keypress", function(e) {
                var code = (e.keyCode ? e.keyCode : e.which);  //兼容火狐 IE   
                if (!$.browser.msie && (e.keyCode == 0x8))  //火狐下 不能使用退格键  
                {
                    return;
                }
                return code >= 48 && code <= 57 || code == 46;
            });
            this.bind("blur", function() {
                if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
                    this.value = this.value.substr(0, this.value.length - 1);
                } else if (isNaN(this.value)) {
                    this.value = " ";
                }
            });
            this.bind("paste", function() {
                var s = clipboardData.getData('text');
                if (!/\D/.test(s))
                    ;
                value = s.replace(/^0*/, '');
                return false;
            });
            this.bind("dragenter", function() {
                return false;
            });
            this.bind("keyup", function() {
                this.value = this.value.replace(/[^\d.]/g, "");
                //必须保证第一个为数字而不是.
                this.value = this.value.replace(/^\./g, "");
                //保证只有出现一个.而没有多个.
                this.value = this.value.replace(/\.{2,}/g, ".");
                //保证.只出现一次，而不能出现两次以上
                this.value = this.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
            });
        };
        $("#handworkMoney").numeral();
    });
    $(function() {
        $(".lixiala").click(function() {
            $(".lixiala").attr("class", "lixiala");
            $(".lixiala").next("div").attr("style", "display:none;");

            $(this).attr("class", "lixiala bton");
            $(this).next("div").attr("style", "display:block;");
        });
        $(".seltime").click(function() {
            $(".timezdy .seltime").addClass("timeon");
            $(".seltimeAll").show();
        });
        $(".seltimeElder").mouseleave(function() {
            $(".timezdy .seltime").removeClass("timeon");
            $(".seltimeAll").hide();
        });
        $(".taobaoname").click(function() {
            $(".timezdy .taobaoname").addClass("timeon");
            $(".taobaonameAll").show();
        });
        $(".taobaonameElder").mouseleave(function() {
            $(".timezdy .taobaoname").removeClass("timeon");
            $(".taobaonameAll").hide();
        });
        $("#stime").click(function() {
            $(this).addClass("t_on");
            WdatePicker({el: 'stimeval', vel: 'starttime', onpicked: function() {
                    $("#stime,#etime").removeClass("t_on");
                    $(".soubox #timescope").val("");
                }});
        });
        $("#etime").click(function() {
            $(this).addClass("t_on");
            WdatePicker({el: 'etimeval', vel: 'endtime', onpicked: function() {
                    $("#stime,#etime").removeClass("t_on");
                    $(".soubox #timescope").val("");
                }});
        });
        $(".setseltime").click(function() {
            var seltime = $(this).attr("name");
            var selname = $(this).text();
            $(".seltime").html("<span>" + selname + "</span><i></i>");
            $("#form1 #seltime").val(seltime);
            $("#form1").submit();
        });
        $(".settaobaoname").click(function() {
            var taobaoid = $(this).attr("name");
            var taobaoname = $(this).text();
            $(".taobaoname").html("<span>" + taobaoname + "</span><i></i>");
            $("#form1 #taobaoid").val(taobaoid);
            $("#form1 #taobaoname").val(taobaoname);
            $("#form1").submit();
        });
        $(".setpagesize").click(function() {
            var pagesize = $(this).attr("name");
            $("#form1 #pagesize").val(pagesize);
            $("#form1").submit();
        });
        $(document).bind("click", function(e) {
            var target = $(e.target);
            if (target.closest(".biaoxiala").length == 0) {
                $(".lixiala").attr("class", "lixiala");
                $(".lixiala").next("div").attr("style", "display:none;");
            }
            if (target.closest("#stime").length == 0) {
                $("#stime").attr("class", "timeselect");
            }
            if (target.closest("#etime").length == 0) {
                $("#etime").attr("class", "timeselect");
            }
        });
        /**
         * 受理
         */
        $(".SetConfrim").click(function() {
            var id = $(this).attr("name");
            $.post("/admini/purchase/setconfrim/", {"id": id}, function(data) {
                if (data == 1) {
                    $(".setStatusName" + id).text("受理成功");
                } else {
                    alert("出现未知错误");
                }
            });
            return false;
        });
        /**
         * 更新订单号或物流
         */
        $(".btnLogistics").click(function() {
            var id = $(this).attr("name");
            var procureNo = $("#procureNo" + id).val();
            var logistics = $("#logistics" + id).val();
            var logisticsNo = $("#logisticsNo" + id).val();
            if (procureNo == "") {
                alert("订单号不能为空");
                return false;
            }
            $("#btnLogistics" + id).val("更新中·");
            $.post("/admini/purchase/updatelogistics/", {"id": id, "procureNo": procureNo, "logistics": logistics, "logisticsNo": logisticsNo}, function(data) {
                if (data == 1) {
                    $("#btnLogistics" + id).val("更新成功");
                    $("#procureNo" + id).val(procureNo);
                    $("#logistics" + id + " option[value='" + logistics + "']").attr("selected", "selected");
                    $("#logisticsNo" + id).val(logisticsNo);
                } else if (data == 2) {
                    alert("订单号不能为空");
                } else if (data == 3) {
                    alert("订单号已存在，不能重复");
                } else if (data == 4) {
                    alert("物流信息已存在，不能重复");
                } else if (data == 9) {
                    alert("该订单不是您受理的，无法操作");
                } else {
                    alert("出现未知错误");
                }
            });
        });
        /**
         * 下单
         */
        $(".SetWaitShip").click(function() {
            var id = $(this).attr("name");
            $.post("/admini/purchase/setwaitship/", {"id": id}, function(data) {
                if (data == 1) {
                    $(".setStatusName" + id).text("下单成功");
                } else if (data == 2) {
                    alert("订单号不能为空");
                } else if (data == 9) {
                    alert("该订单不是您受理的，无法操作");
                } else {
                    alert("出现未知错误");
                }
            });
            return false;
        });
        /**
         * 卖家已发货
         */
        $(".SetSeller").click(function() {
            var id = $(this).attr("name");
            $.post("/admini/purchase/setseller/", {"id": id}, function(data) {
                if (data == 1) {
                    $(".setStatusName" + id).text("设置成功");
                } else if (data == 2) {
                    alert("物流信息不能为空");
                } else if (data == 3) {
                    alert("该订单状态下不能设置卖家已发货");
                } else if (data == 9) {
                    alert("该订单不是您受理的，无法操作");
                } else {
                    alert("出现未知错误");
                }
            });
            return false;
        });
        /**
         * 入库
         */
        $(".SetInStore").click(function() {
            var id = $(this).attr("name");
            $.post("/admini/purchase/setinstore/", {"id": id}, function(data) {
                if (data == 1) {
                    $(".setStatusName" + id).text("设置成功");
                } else if (data == 3) {
                    alert("该状态下订单不能设置入库");
                } else {
                    alert("出现未知错误");
                }
            });
        });
        /**
         * 合并
         */
        $(".MergerOrder").click(function() {
            var idlist = '';
            var i = 0;
            $('input[name="MergerCheck"]:checked').each(function() {
                idlist += $(this).val() + ',';
                i++;
            });
            if (idlist == "") {
                alert("请选择需要合并的运单！");
                return;
            }
            if (i == 1) {
                alert("一个订单无法合并！");
                return;
            }
            confirm("您确定合并该代购订单", function() {
                $.ajax({
                    type: 'POST',
                    url: '/admini/purchase/mergerorder/itemlist/' + idlist,
                    success: function(data) {
                        if (data == 1) {
                            alert("合并成功");
                            location.reload();
                        } else if (data == 2) {
                            alert("只能合并受理订单");
                        } else if (data == 3) {
                            alert("不能合并不同客户的订单");
                        } else if (data == 4) {
                            alert("一个订单无法合并");
                        } else if (data == 5) {
                            alert("无法合并已经删除的订单");
                        } else if (data == 9) {
                            alert("合并的订单不是你受理的");
                        } else {
                            alert("发生未知错误，请重新操作");
                        }
                    }
                });
            });
        });
        /**
         * 单项退款
         */
        $(".SingleRetuenMoney").click(function() {
            var id = $(this).attr("i");
            var singleId = $(this).attr("name");
            var price = $(this).parent("div").find("p span").text();
            var num = $(".quantity" + singleId).text();
            var sum = accMul(price, num);
            confirm("您确认该产品单项退款,退款：" + sum + "元?", function() {
                $.post("/admini/purchase/singlereturn", {"id": id, "singleId": singleId}, function(data) {
                    if (data == 1) {
                        alert("退款成功");
                        $("#SingleRetuenMoney" + singleId).html('<font color="green">已退款</font>');
                    } else if (data == 2) {
                        alert("不能退款该状态下的订单");
                    } else if (data == 3) {
                        alert("该商品已经退款了");
                    } else if (data == 9) {
                        alert("该订单不是您受理的");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                });
            });
        });
        /**
         * 整个取消退款
         */
        $(".cancel").click(function() {
            var id = $(this).attr("name");
            confirm("您确认取消该订单吗", function() {
                $.post("/admini/purchase/cancel", {"id": id}, function(data) {
                    if (data.type == 1) {
                        alert("取消成功");
                        $(".setStatusName" + id).html("");
                        $(".getStatusName" + id).html('<font color="green">已取消</font>');
                        $.each(data.result, function(key, val) {
                            $("#SingleRetuenMoney" + key).html('<font color="green">已退款</font>');
                        });
                    } else if (data.type == 2) {
                        alert("不能取消该状态下的订单");
                    } else if (data.type == 9) {
                        alert("该订单不是您受理的");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                });
            });
        });

        $(".addTodo").click(function() {
            var id = $(this).attr("name");
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#addTodoTitle").closest("li").addClass("wt_on");
            $("#addTodoTitle").closest("li").show();
            $("#addTodoIframe").attr("src", "/admini/todotask/add?objectId=" + id + "&objectType=<?php echo Application_Model_DomainobjectType::ObjectType_Order; ?>");
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#addTodoConent").show();
        });
        /**
         * 获取备注
         */
        $(".addRemark").click(function() {
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#addRemarkTitle").closest("li").addClass("wt_on");
            $("#addRemarkTitle").closest("li").show();
            var id = $(this).attr("name");
            $.post("/admini/purchase/getcomment", {"id": id}, function(data) {
                if (data) {
                    $("#addRemarkConent #remark").val(data);
                } else {
                    $("#addRemarkConent #remark").val("");
                }
            });
            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#addRemarkConent").show();
        });
        /**
         * 物流跟踪 
         */
        $(".traceLogistics").click(function() {
            var loading = '<div class="loading" style="background: url(/images/share/anim_loading_sm_082208.gif) no-repeat 0px center;margin-top: 10px;line-height: 80px;padding-left: 25px;color: #339900;"><p>正在获取物流信息…</p></div>';
            $("#traceConent .wt_center").html(loading);
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#traceTitle").closest("li").addClass("wt_on");
            $("#traceTitle").closest("li").show();
            var id = $(this).attr("name");
            $.post("/admini/purchase/getingexpress", {"id": id}, function(data) {
                var html = "<table><tbody><tr><td class='li15'>&nbsp;&nbsp;&nbsp;时间</td><td class='li15'>&nbsp;&nbsp;位置</td><td class='li35'>&nbsp;&nbsp;&nbsp;描述</td></tr>";
                if (data.content) {
                    $.each(data.content, function(key, val) {
                        html += "<tr><td class='li15' style='font-size:12px;'><div class='lileft bianhao'>" + val.DATETIME + "</div></td>";
                        html += "<td class='li15' style='font-size:12px;'><div class='lileft bianhao'>" + val.PLACE + "</div></td>";
                        html += "<td class='li35' style='font-size:12px;'><div class='lileft bianhao'>" + val.INFO + "</div></td></tr>";
                    });
                } else {
                    html += "<tr><td colspan='3'>无法获取物流信息</td></tr>";
                }
                html += "</tbody></table>";
                $("#traceConent .wt_center").html(html);
            });
            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#traceConent").show();
        });
        /**
         * 添加备注
         */
        $("#subAddRemark").click(function() {
            var orderId = $(".houtai_overlay #orderId").val();
            var remark = $("#addRemarkConent #remark").val();
            if (remark == '')
            {
                alert("请输入说明信息.");
                return;
            }
            $.post("/admini/purchase/setcomment", {"orderId": orderId, "comment": remark}, function(data) {
                if (data == 1) {
                    alert("提交成功");
                    $("#itemDescription" + orderId).text(remark);
                } else {
                    alert("发生未知错误，请重新操作");
                }
                $(".houtai_overlay").hide();
                $(".tanchuang").hide();
            });
        });
        /**
         * 预定信息
         */
        $(".setDateShip").click(function() {
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#reserveOrderTitle").closest("li").addClass("wt_on");
            $("#reserveOrderTitle").closest("li").show();
            var id = $(this).attr("name");
            $.post("/admini/purchase/getreserveorder", {"id": id}, function(data) {
                if (data.reserveTime) {
                    $("#reserveOrderConent #reserveTime").val(data.reserveTime);
                }
            });
            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#reserveOrderConent").show();
        });
        /**
         * 问题信息展示
         */
        $(".showProblem").click(function() {
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#isProblemTitle").closest("li").addClass("wt_on");
            $("#isProblemTitle").closest("li").show();
            $("#isProblemConent .wt_center").html("");
            var id = $(this).attr("name");
            $.post("/admini/purchase/problemshow/", {"orderId": id}, function(data) {
                if (data.type == 1) {
                    var html = "";
                    $.each(data.arrProblem, function(key, val) {
                        html += '<div class="' + (val.issueetype == 1 ? 'wt_uuch' : 'wt_kehu') + '">';
                        html += '<h2>' + (val.issueetype == 1 ? '悠奇客服' : ('回复人：<a href="/admini/manageuser/userdetail/id/' + val.userId + '" target="_blank">' + val.userName + '</a>'));
                        html += '<span>' + val.dateCreated + '</span></h2>';
                        html += '<p>' + val.content + '</p></div>';
                    });
                    $("#isProblemConent .wt_center").html(html);
                }
            });
            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#isProblemConent").show();
        });
        /**
         * 设置问题
         */
        $("#subIsProblem").click(function() {
            var content  = $("#content").val();
            var id       = $(".houtai_overlay #orderId").val();
            var repay    = $("#repay").val();
            var repaysum = $("#repay-sum").val();
            if(isNaN(repaysum)){
                alert("补交金额需要为数字！");
                return false;
            }
            if (content == "") {
                alert("问题内容不能为空！");
                return false;
            }
            $.post("/admini/purchase/addproblem/", {"id": id, "content": content, 'repay' : repay, 'repaysum': repaysum}, function(data) {
                if (data.type == 1) {
                    var html = "";
                    html += '<div class="wt_uuch"><h2>悠奇客服';
                    html += '<span>' + data.datetime + '</span></h2><p>' + content + '</p></div>';
                    $("#isProblemConent .wt_center").append(html);
                    $(".iconShow" + id + " showProblem").addClass("ts3");
                } else if (data.type == 2) {
                    alert("问题内容不能为空！");
                } else if (data.type == 9) {
                    alert("该订单不是您受理的");
                } else {
                    alert("发生未知错误，请重新操作");
                }
                $("#content").val("");
            });
        });
        /**
         * 问题解决
         */
        $(".SolveComplete").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            confirm("您确认该代购订单的问题已经解决？", function() {
                $.post("/admini/purchase/solveproblem", {"id": id}, function(data) {
                    if (data == 1) {
                        alert("解决成功");
                        $(".iconShow" + id + " .showProblem").removeClass("ts3");
                        $(".iconShow" + id + " .showProblem").addClass("ts3_");
                    } else if (data == 2) {
                        alert("该订单不是问题订单");
                    } else if (data == 9) {
                        alert("该订单不是您受理的");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                });
            });
        });
        /**
         * 异常信息展示
         */
        $(".abnormalico").click(function() {
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#abnormalTitle").closest("li").addClass("wt_on");
            $("#abnormalTitle").closest("li").show();
            $("#abnormalConent .wt_center").html("");
            var id = $(this).attr("name");
            $.post("/admini/purchase/abnormalshow/", {"orderId": id}, function(data) {
                if (data.type == 1) {
                    var html = "<table style='width:680px;'><tr class='abnormalTr'><td style='width:10%;'>添加人</td><td style='width:20%;'>时间</td><td>内容</td><td style='width:10%;'>状态</td><td style='width:10%;'>操作</td></tr>";
                    if (data.orderAbnrmal != "") {
                        html += "<tr class='abnormalTr'><td colspan='2'>整个包裹问题：</td><td>订单编号：" + data.orderAbnrmal.orderNum + "</td><td colspan='2'>订单标识符：" + data.orderAbnrmal.SoleNo + "</td></tr>";
                        $.each(data.orderAbnrmal.arrAbnormal, function(orderKey, orderVal) {
                            html += "<tr class='AbnormalKey" + orderKey + "'><td>" + orderVal.operator + "</td>";
                            html += "<td>" + orderVal.dateCreated + "</td>";
                            html += "<td>" + orderVal.content + "</td>";
                            html += "<td>" + orderVal.statusName + "</td><td>";
                            if (orderVal.status == 0) {
                                html += "<a href='javascript:void(0)' class='indexa disposeAbnormal' name='" + orderKey + "'>处理</a>";
                                html += "<a href='javascript:void(0)' class='indexa delAbnormal' name='" + orderKey + "' style='margin-left:10px;'>删除</a>";
                            } else {
                                html += "<font style='color:#c00'>已处理</font>";
                            }
                            html += "</td></tr>";
                            if (orderVal.arrImg) {
                                html += "<tr class='AbnormalImg" + orderKey + "'><td>问题图片：</td><td colspan='3'><div style='width:100%;height:56px;padding:3px;overflow: auto;'>";
                                $.each(orderVal.arrImg, function(imgItem, imgVal) {
                                    html += "<a href='<?php echo $this->cdn; ?>" + imgVal.imgUrl + "' target='_blank'><img src='<?php echo $this->cdn; ?>" + imgVal.img + "' style='width:50px;height:50px;margin-right:5px' /></a>";
                                });
                                html += "</div></td>";
                                if (1 == orderVal.status) {
                                    html += "<td><div><a class=\"rePreveStep\" href=\"javascript:void(0)\" rel=\"" + orderKey + "\"><span>重新操作</span></a></div></td>";
                                }
                                html += "</tr>";
                            }
                            html += "<tr class='AbnormalDispose" + orderKey + " abnormalTr'><td>处理异常：</td><td colspan='4'><div class='disposeContent" + orderKey + "' style='width:98%;'><ul>";
                            if (orderVal.arrTrack) {
                                $.each(orderVal.arrTrack, function(trackKey, trackVal) {
                                    html += "<li>" + trackVal.dateCreated + "&nbsp;&nbsp;" + trackVal.content + "&nbsp;&nbsp;-----&nbsp;&nbsp;" + trackVal.operator + "</li>";
                                });
                            }
                            html += "</ul></div></td></tr>";
                        });
                    }
                    if (data.itemAbnrmal != "") {
                        $.each(data.itemAbnrmal, function(key, val) {
                            html += '<tr class="abnormalTr"><td style="line-height: 20px" class="w0" colspan="5"><div style="float:left;width: 55px;margin: 5px 0px;">';
                            html += '<img src="' + val.img + '" width="50px" height="50px" style="vertical-align:middle;margin-top: 5px;"></div><div style="float:left;width: 90%;">&nbsp;&nbsp;';
                            html += val.name + '</div><div style="float:left;color:#666;width: 90%;">&nbsp;&nbsp;' + val.alias + '</div>';
                            html += '</td></tr>';
                            $.each(val.arrAbnormal, function(AbnormalKey, AbnormalVal) {
                                html += "<tr class='AbnormalKey" + AbnormalKey + "'><td>" + AbnormalVal.operator + "</td>";
                                html += "<td>" + AbnormalVal.dateCreated + "</td>";
                                html += "<td>" + AbnormalVal.content + "</td>";
                                html += "<td>" + AbnormalVal.statusName + "</td><td>";
                                if (AbnormalVal.status == 0) {
                                    html += "<a href='javascript:void(0)' class='indexa disposeAbnormal' name='" + AbnormalKey + "'>处理</a>";
                                    html += "<a href='javascript:void(0)' class='indexa delAbnormal' name='" + AbnormalKey + "' style='margin-left:10px;'>删除</a>";
                                } else {
                                    html += "<font style='color:#c00'>已处理</font>";
                                }
                                html += "</td></tr>";
                                if (AbnormalVal.arrImg) {
                                    html += "<tr class='AbnormalImg" + AbnormalKey + "'><td>问题图片：</td><td colspan='3'><div style='width:100%;height:56px;padding:3px;overflow: auto;'>";
                                    $.each(AbnormalVal.arrImg, function(imgItem, imgVal) {
                                        html += "<a href='<?php echo $this->cdn; ?>" + imgVal.imgUrl + "' target='_blank'><img src='<?php echo $this->cdn; ?>" + imgVal.img + "' style='width:50px;height:50px;margin-right:5px' /></a>";
                                    });
                                    html += "</div></td>";
                                    if (1 == AbnormalVal.status) {
                                        html += "<td><div><a class=\"rePreveStep\" href=\"javascript:void(0)\" rel=\"" + AbnormalKey + "\"><span>重新操作</span></a></div></td>";
                                    }

                                    html += "</tr>";
                                }
                                html += "<tr class='AbnormalDispose" + AbnormalKey + " abnormalTr'><td>处理异常：</td><td colspan='4'><div class='disposeContent" + AbnormalKey + "' style='width:98%;'><ul>";
                                if (AbnormalVal.arrTrack) {
                                    $.each(AbnormalVal.arrTrack, function(trackKey, trackVal) {
                                        html += "<li>" + trackVal.dateCreated + "&nbsp;&nbsp;" + trackVal.content + "&nbsp;&nbsp;-----&nbsp;&nbsp;" + trackVal.operator + "</li>";
                                    });
                                }
                                html += "</ul></div></td></tr>";
                            });
                        });
                    }
                    html += '</table>';
                    $("#abnormalConent .wt_center").html(html);
                    if (data.lossUser) {
                        var ahtml = "由" + data.lossUser + "造成的损耗，已记录";
                    } else {
                        var ahtml = '<a class="indexa loss" href="javascript:void(0);" ><span>登记代购人员出错</span></a>';
                    }
                    $("li.lossLog").html(ahtml);
                    $('.rePreveStep').bind('click', rePreveStep);
                }
            });

            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#abnormalConent").show();
        });
        /**
         * 异常的处理
         */
        $(".disposeAbnormal").live("click", function() {
            $("#abnormalConent .wt_center tr").removeClass("bColor");
            var abnormalId = $(this).attr("name");
            $(this).parents("tr").addClass("bColor");
            $("#abnormalConent #abnormalId").val(abnormalId);

            $("#abnormalConent .wt_caozuo").show();
            $("#abnormalConent .wt_type").show();

        });
        /**
         * 处理类型的选择
         */
        $(".disposeType").click(function() {
            var type = $(this).val();
            $(".scheme").hide();
            if (type == 1) {
                $(".scheme").show();
            }
        });
        /**
         * 添加异常说明
         */
        $("#subAbnormal").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            var abnormalId = $("#abnormalConent #abnormalId").val();
            var abnormalType = $("#abnormalConent .wt_type input[name='isAbnormal']:checked").val();
            var abnormalScheme = $("#abnormalConent .wt_type input[name='abnormalScheme']:checked").val();
            var SchemeName = $("#abnormalConent .wt_type input[name='abnormalScheme']:checked").parent("label").text();
            var abnormalCause = $("#abnormalCause").val();
            if (abnormalCause == "") {
                alert("问题内容不能为空！");
                return false;
            }
            if (abnormalId == "") {
                alert("出现未知错误，请刷新在试！");
                return false;
            }
            if (abnormalType == 1) {
                confirm("您确认是该异常订单的异常处理是：" + SchemeName + "吗？", function() {
                    $.post("/admini/purchase/addabnormal/", {"id": id, "cause": abnormalCause, "abnormalId": abnormalId, "abnormalType": abnormalType, "abnormalScheme": abnormalScheme}, function(data) {
                        if (data.type == 1) {
                            var html = "<li>" + data.dateCreated + "&nbsp;&nbsp;" + data.cause + "&nbsp;&nbsp;-----&nbsp;&nbsp;" + data.operator + "</li>";
                            $(".disposeContent" + abnormalId + " ul").append(html);
                            $(".AbnormalImg" + abnormalId).removeClass("abnormalTr");
                            $(".AbnormalDispose" + abnormalId).addClass("abnormalTr");
                            if (abnormalType == 1) {
                                $(".disposeAbnormal[name='" + abnormalId + "']").parent("td").html("<font style='color:#c00'>已处理</font>");
                                $("#abnormalConent .wt_type").hide();
                                $("#abnormalConent .wt_caozuo").hide();
                                $("#abnormalConent .abnormalCause").val("");
                                $("#abnormalConent .wt_center tr").removeClass("bColor");
                            }
                        } else if (data.type == 2) {
                            alert("问题内容不能为空！");
                        } else if (data.type == 9) {
                            alert("该订单不是您受理的");
                        } else {
                            alert("发生未知错误，请重新操作");
                        }
                        $("#abnormalCause").val("");
                    });
                });
            } else {
                $.post("/admini/purchase/addabnormal/", {"id": id, "cause": abnormalCause, "abnormalId": abnormalId, "abnormalType": abnormalType, "abnormalScheme": abnormalScheme}, function(data) {
                    if (data.type == 1) {
                        var html = "<li>" + data.dateCreated + "&nbsp;&nbsp;" + data.cause + "&nbsp;&nbsp;-----&nbsp;&nbsp;" + data.operator + "</li>";
                        $(".disposeContent" + abnormalId + " ul").append(html);
                        $(".AbnormalImg" + abnormalId).removeClass("abnormalTr");
                        $(".AbnormalDispose" + abnormalId).addClass("abnormalTr");
                        if (abnormalType == 1) {
                            $(".disposeAbnormal[name='" + abnormalId + "']").parent("td").html("<font style='color:#c00'>已处理</font>");
                            $("#abnormalConent .wt_type").hide();
                            $("#abnormalConent .wt_caozuo").hide();
                            $("#abnormalConent .abnormalCause").val("");
                            $("#abnormalConent .wt_center tr").removeClass("bColor");
                        }
                    } else if (data.type == 2) {
                        alert("问题内容不能为空！");
                    } else if (data.type == 9) {
                        alert("该订单不是您受理的");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                    $("#abnormalCause").val("");
                });
            }
        });
        /**
         * 代购人员出错
         */
        $(".loss").live("click", function() {
            var id = $(".houtai_overlay #orderId").val();
            $("#lossUser").val("");
            $("#lossMoney").val("");
            $("#lossReason").val("");
            $.post("/admini/purchase/lossshow", {"id": id}, function(data) {
                if (data.type == 1) {
                    $(".wt_nav ul li").removeClass("wt_on");
                    $(".wt_nav ul li").hide();
                    $(".wenti_box").hide();
                    $("#lossTitle").closest("li").addClass("wt_on");
                    $("#lossTitle").closest("li").show();
                    $(".houtai_overlay").show();
                    $(".tanchuang").show();
                    $("#lossConent").show();
                    if (data.lossUser) {
                        $("#lossUser").val(data.lossUser);
                    } else {
                        $("#lossUser").removeAttr("readonly");
                    }
                    $("#lossMoney").val(data.lossMoney);
                } else {
                    alert("发生未知错误，请重新操作");
                    $(".nui-msgbox-close").click();
                }
            });
        });
        $("#subLost").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            var lossUser = $("#lossUser").val();
            var lossMoney = $("#lossMoney").val();
            var lossReason = $("#lossReason").val();
            if (lossUser == "") {
                alert("造成损耗的下单人不能为空！");
                return;
            }
            if (lossMoney == "") {
                alert("造成损耗的金额不能为空！");
                return;
            }
            if (lossReason == "") {
                alert("损耗的原因不能为空!");
                return;
            }
            confirm("您确认是该异常订单的下单人：" + lossUser + "造成" + lossMoney + "元的损耗？", function() {
                $.post("/admini/purchase/subloss", {"id": id, "lossUser": lossUser, "lossMoney": lossMoney, "lossReason": lossReason}, function(data) {
                    if (data == 1) {
                        var ahtml = "由" + lossUser + "造成的损耗，已记录";
                        $("span.lossLog").html(ahtml);
                        $(".wt_nav ul li").removeClass("wt_on");
                        $(".wt_nav ul li").hide();
                        $(".wenti_box").hide();
                        $("#abnormalTitle").closest("li").addClass("wt_on");
                        $("#abnormalTitle").closest("li").show();
                        $(".houtai_overlay #orderId").val(id);
                        $(".houtai_overlay").show();
                        $(".tanchuang").show();
                        $("#abnormalConent").show();
                    } else if (data == 2) {
                        alert("造成损耗的下单人、金额以及原因不能为空！");
                    } else {
                        alert("发生未知错误，请重新操作");
                        $(".nui-msgbox-close").click();
                    }
                });
            });
        });
        /**
         * 设置预订
         */
        $("#subReserveOrder").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            var reserveTime = $("#reserveTime").val();
            var reserveCause = $("#reserveCause").val();
            if (reserveTime == "" || reserveCause == "") {
                alert("预订时间和预订原因不能为空!");
                return;
            }
            confirm("您确定该代购为预订订单，发货时间为" + reserveTime + "？", function() {
                $.post("/admini/purchase/setreserveorder", {"id": id, "reserveTime": reserveTime, "reserveCause": reserveCause}, function(data) {
                    if (data == 1) {
                        alert("预定成功");
                        location.reload();
                    } else if (data == 2) {
                        alert("该订单状态下不可能预定");
                    } else if (data == 9) {
                        alert("该订单不是您受理的");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                    $(".nui-msgbox-close").click();
                });
            });
        });
        /**
         * 手工操作历史
         */
        $(".setHandwork").click(function() {
            var id = $(this).attr("name");
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#handworkTitle").closest("li").addClass("wt_on");
            $("#handworkTitle").closest("li").show();
            $.post("/admini/purchase/handworkshow/", {"orderId": id}, function(data) {
                if (data.type == 1) {
                    var html = "";
                    $.each(data.arrCheck, function(key, val) {
                        html += "<p><span>" + val.dateCreated + "</span><span style='margin-left:20px;'>" + val.applyName + "申请" + val.checkType + "</span>";
                        html += "<span style='margin-left:20px;'>原因:" + val.reason + "</span><span style='margin-right: 20px;float: right;'>" + val.statusName + "</span>";
                    });
                    $(".checkHistory").html(html);
                }
            });
            $(".houtai_overlay #orderId").val(id);
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#handworkConent").show();
        });
        /**
         * 添加手工操作
         */
        $("#subHandworkr").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            var hendworkType = $("#hendworkType").val();
            var hendworkName = $("#hendworkType option[value='" + hendworkType + "']").text();
            var handworkMoney = $("#handworkMoney").val();
            var handworkReason = $("#handworkReason").val();
            var businessType = $('#businessType').val();
            if (handworkMoney == "" || handworkMoney == 0) {
                alert("金额不能为空或零");
                return;
            }
            if (handworkReason == "") {
                alert("原因不能为空");
                return;
            }
            confirm("您确认为该订单该用户" + hendworkName + handworkMoney + "元？", function() {
                $.post("/admini/purchase/sethandwork/", {"id": id, "hendworkType": hendworkType, "handworkMoney": handworkMoney, "handworkReason": handworkReason, "businessType": businessType}, function(data) {
                    if (data == 1) {
                        alert("手工操作成功！");
                        $(".setHandwork[name='" + id + "']").attr("style", "background:url('/admins/images/icons/yellow_money.png');");
                        $("#handworkMoney").val("");
                        $("#handworkReason").val("");
                        $(".retanchuang").click();
                    } else if (data == 2) {
                        alert("操作金额超代购总价！");
                    } else if (data == 3) {
                        alert("用户余额不足！");
                    } else if (data == 4) {
                        alert("状态错误！");
                    } else if (data == 9) {
                        alert("没有权限操作！请更改受理人！");
                        $(".nui-msgbox-close").click();
                    } else {
                        alert("出现未知错误，请刷新再试");
                        $(".nui-msgbox-close").click();
                    }
                });
            });
        });
        $(".addLog").click(function() {
            var id = this.name;
            $.post(
                    "/admini/purchase/operatelog",
                    {
                        operatelog: id
                    },
            function(data) {
                if (data.type == 1) {
                    var html = "<table>";
                    $.each(data.arrCheck, function(key, val) {
                        html += "<tr><td width='100px'>时间：" + val.dateAdd + "</td><td width='100px'style='margin-left:20px;'>操作人" + val.operator + "</td>";
                        html += "<td width='100px'>" + val.content + "</td><td width='100px'>" + val.IsUser + "</td>";
                    });
                    $(".operatelog").html(html);
                }
            }
            );
            var id = $(this).attr("name");
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#addLogTitle").closest("li").addClass("wt_on");
            $("#addLogTitle").closest("li").show();
            $("#addLogTime").val("<?php echo date("Y-m-d H:i:s"); ?>");
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#addLogConent").show();
            $(".houtai_overlay #orderId").val(id);
        });
        $("#subAddLog").click(function() {
            var id = $(".houtai_overlay #orderId").val();
            var addLogTime = $("#addLogTime").val();
            var addLogContent = $("#addLogContent").val();
            var logIsVisible = $("#logIsVisible").val();
            if (addLogTime == "") {
                alert("时间不能为空");
                return;
            }
            if (addLogContent == "") {
                alert("日志内容不能为空");
                return;
            }
            $.post("/admini/purchase/addtracklog", {"id": id, "addLogTime": addLogTime, "addLogContent": addLogContent, "logIsVisible": logIsVisible}, function(data) {
                if (data == 1) {
                    alert("添加成功");
                } else {
                    alert("发生未知错误，请重新操作");
                }
            });
        });
        /**
         * 拆分准备
         */
        $(".SplitOrder").click(function() {
            var idlist = '';
            var orderId = "";
            var judge = false;
            $('input[name="SplitCheck"]:checked').each(function() {
                var splitid = $(this).val();
                if (orderId == "") {
                    orderId = $(this).attr("class");
                }
                var middle = $(this).attr("class");
                if (middle != orderId) {
                    judge = true;
                    return false;
                }
                idlist += splitid + ',';

            });
            if (judge) {
                alert("需要拆分的商品不是同一订单中的！");
                return;
            }
            if (idlist == "") {
                alert("请选择需要拆分的商品！");
                return;
            }
            $.post("/admini/purchase/getiteminfo/", {"orderId": orderId, "idlist": idlist}, function(data) {
                if (data.type == 1) {
                    $(".splitTr").remove();
                    var html = "";
                    $.each(data.result, function(key, val) {
                        html += '<tr class="splitTr"><td style="width: 420px;" class="w0"><div style="float:left;width: 55px;">';
                        html += '<img src="' + val.img + '" width="50px" height="50px" style="vertical-align:middle;"></div><div style="float:left;width: 80%;">&nbsp;&nbsp;';
                        html += val.name + '</div><div style="float:left;color:#666;width: 80%;">&nbsp;&nbsp;' + val.alias + '</div></td>';
                        html += '<td style="width: 80px;"><div class="liright" style="padding-right: 0px;">拆分数量：</div></td><td style="width: 150px;">';
                        html += '<input type="text" id="splitNum' + val.id + '" name="splitNum" value="' + val.num + '" goodsid="' + val.id + '" onkeyup="value=value.replace(/[^\\\d]/g,\'\')"';
                        html += 'onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\\\d]/g,\'\'))"></td></tr>';
                    });
                    $("#splitOrderConent .content_bottom").before(html);
                } else if (data.type == 2) {
                    alert("选择拆分中的商品有已退款了的");
                    $(".nui-msgbox-close").click();
                    return;
                } else if (data.type == 3) {
                    alert("选择拆分的商品不属于同一订单");
                    $(".nui-msgbox-close").click();
                    return;
                } else if (data.type == 9) {
                    alert("选择拆分的订单不是你受理的");
                    $(".nui-msgbox-close").click();
                    return;
                } else {
                    alert("出现未知错误，请刷新再试");
                    $(".nui-msgbox-close").click();
                    return;
                }
            });
            $(".houtai_overlay #orderId").val(orderId);
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#splitOrderTitle").closest("li").addClass("wt_on");
            $("#splitOrderTitle").closest("li").show();
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#splitOrderConent").show();
        });
        /**
         * 确认拆分
         */
        $("#subSplitOrder").click(function() {
            var result = "";
            $('input[name="splitNum"]').each(function() {
                var goodsId = $(this).attr("goodsId");
                if (!$(".splitTr" + goodsId).is(":hidden")) {
                    result += goodsId + ":" + $(this).val() + ",";
                }
            });
            var id = $(".houtai_overlay #orderId").val();
            confirm("您确定拆分该订单？", function() {
                $.post("/admini/purchase/splitorder", {"id": id, "splitnum": result}, function(data) {
                    if (data == 1) {
                        alert("拆分成功");
                        location.reload();
                    } else if (data == 2) {
                        alert("只能拆分受理订单");
                    } else if (data == 3) {
                        alert("拆分数量不对");
                    } else if (data == 9) {
                        alert("该订单不是您受理的");
                        $(".nui-msgbox-close").click();
                    } else {
                        alert("发生未知错误，请重新操作");
                        $(".nui-msgbox-close").click();
                    }
                });
            });
        });
        /**
         * 代购补发    
         */
        $(".orderReissue").click(function() {
            var orderId = $(this).attr("name");
            $(".houtai_overlay #orderId").val(orderId);
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#orderReissueTitle").closest("li").addClass("wt_on");
            $("#orderReissueTitle").closest("li").show();
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#orderReissueContent").show();
        });
        /**
         * 添加代购的补发物流信息
         */
        $("#subReissueOrder").click(function() {
            var orderId = $(".houtai_overlay #orderId").val();
            var reissueLogistics = $("#orderReissueContent .wt_center #reissueLogistics").val();
            var reissueLogisticsName = $("#orderReissueContent .wt_center #reissueLogistics").find("option:selected").text();
            var reissueLogisticsNo = $("#orderReissueContent .wt_center #reissueLogisticsNo").val();
            if (reissueLogisticsNo == "") {
                alert("补发物流不能为空！");
                return;
            }
            $.post("/admini/purchase/reissueorder/", {"orderId": orderId, "reissueLogistics": reissueLogistics, "reissueLogisticsNo": reissueLogisticsNo}, function(data) {
                if (data == 1) {
                    $(".orderReissue").html("补发");
                    if($(".orderReissue").next('span')){
                        $(".orderReissue").next('span').html("(" +reissueLogisticsName + ":" + reissueLogisticsNo + ")");
                    }else{
                        $(".orderReissue").after("<span>(" +reissueLogisticsName + ":" + reissueLogisticsNo + ")</span>");
                    }
                    
                    $(".orderReissue[name='" + orderId + "']").unbind();
                    $(".houtai_overlay").hide();
                    $(".tanchuang").hide();
                } else if (data == 0) {
                    alert("发生未知错误，请重新操作");
                    $(".nui-msgbox-close").click();
                } else if (data == 2) {
                    alert("补发物流不能为空！");
                    return;
                } else {
                    alert("发生未知错误，请重新操作");
                    $(".nui-msgbox-close").click();
                }
            });
        });
        /**
         * 展示代购的退换货信息
         */
        $(".orderReturnChange").click(function() {
            var orderId = $(this).attr("name");
            $.post("/admini/purchase/abnormalshow/", {"orderId": orderId, "isType": 1}, function(data) {
                if (data.type == 1) {
                    $("#returnChangeOrderConent .wt_center .reChangeCause").remove();
                    var html = "<table style='width:680px;' class='reChangeCause'><tr class='abnormalTr'><td style='width:11%;'>添加人</td><td style='width:18%;'>时间</td><td>内容</td><td style='width:10%;'>状态</td><td style='width:10%;'>操作</td></tr>";
                    if (data.orderAbnrmal != "") {
                        html += "<tr class='abnormalTr'><td colspan='2'>整个包裹问题：</td><td>订单编号：" + data.orderAbnrmal.orderNum + "</td><td colspan='2'>订单标识符：" + data.orderAbnrmal.SoleNo + "</td></tr>";
                        $.each(data.orderAbnrmal.arrAbnormal, function(orderKey, orderVal) {
                            html += "<tr class='AbnormalKey" + orderKey + "'><td>" + orderVal.operator + "</td>";
                            html += "<td>" + orderVal.dateCreated + "</td>";
                            html += "<td>" + orderVal.content + "</td>";
                            html += "<td>" + orderVal.statusName + "</td><td>";
                            if (orderVal.status == 0) {
                                html += "<a href='javascript:void(0)' class='indexa disposeAbnormal' name='" + orderKey + "'>处理</a>";
                                html += "<a href='javascript:void(0)' class='indexa delAbnormal' name='" + orderKey + "' style='margin-left:10px;'>删除</a>";
                            } else {
                                html += "<font style='color:#c00'>已处理</font>";
                            }
                            html += "</td></tr>";
                            if (orderVal.arrImg) {
                                html += "<tr class='AbnormalImg" + orderKey + "'><td>问题图片：</td><td colspan='3'><div style='width:100%;height:56px;padding:3px;overflow: auto;'>";
                                $.each(orderVal.arrImg, function(imgItem, imgVal) {
                                    html += "<a href='<?php echo $this->cdn; ?>" + imgVal.imgUrl + "' target='_blank'><img src='<?php echo $this->cdn; ?>" + imgVal.img + "' style='width:50px;height:50px;margin-right:5px' /></a>";
                                });
                                html += "</div></td>";
                                if (1 == orderVal.status) {
                                    html += "<td><div><a class=\"rePreveStep\" href=\"javascript:void(0)\" rel=\"" + orderKey + "\"><span>重新操作</span></a></div></td>";
                                }

                                html += "</tr>";
                            }
                            html += "<tr class='AbnormalDispose" + orderKey + " abnormalTr'><td>处理异常：</td><td colspan='4'><div style='width:100%;float:left;'>";
                            if (orderVal.arrTrack) {
                                $.each(orderVal.arrTrack, function(trackKey, trackVal) {
                                    html += "<div style='width:20%;float:left;'>" + trackVal.dateCreated + "</div>";
                                    html += "<div style='width:58%;float:left;'>" + trackVal.content + "</div>";
                                    html += "<div style='width:10%;float:left;'>" + trackVal.operator + "</div>";

                                });
                            }
                            html += "</div></td></tr>";
                        });
                    }
                    if (data.itemAbnrmal != "") {
                        $.each(data.itemAbnrmal, function(key, val) {
                            html += '<tr class="abnormalTr"><td style="line-height: 20px" class="w0" colspan="5"><div style="float:left;width: 55px;margin: 5px 0px;">';
                            html += '<img src="' + val.img + '" width="50px" height="50px" style="vertical-align:middle;margin-top: 5px;"></div><div style="float:left;width: 90%;">&nbsp;&nbsp;';
                            html += val.name + '</div><div style="float:left;color:#666;width: 90%;">&nbsp;&nbsp;' + val.alias + '</div>';
                            html += '</td></tr>';
                            $.each(val.arrAbnormal, function(AbnormalKey, AbnormalVal) {
                                html += "<tr class='AbnormalKey" + AbnormalKey + "'><td>" + AbnormalVal.operator + "</td>";
                                html += "<td>" + AbnormalVal.dateCreated + "</td>";
                                html += "<td>" + AbnormalVal.content + "</td>";
                                html += "<td>" + AbnormalVal.statusName + "</td><td>";
                                if (AbnormalVal.status == 0) {
                                    html += "<a href='javascript:void(0)' class='indexa disposeAbnormal' name='" + AbnormalKey + "'>处理</a>";
                                    html += "<a href='javascript:void(0)' class='indexa delAbnormal' name='" + AbnormalKey + "' style='margin-left:10px;'>删除</a>";
                                } else {
                                    html += "<font style='color:#c00'>已处理</font>";
                                }
                                html += "</td></tr>";
                                if (AbnormalVal.arrImg) {
                                    html += "<tr class='AbnormalImg" + AbnormalKey + "'><td>问题图片：</td><td colspan='3'><div style='width:100%;height:56px;padding:3px;overflow: auto;'>";
                                    $.each(AbnormalVal.arrImg, function(imgItem, imgVal) {
                                        html += "<a href='<?php echo $this->cdn; ?>" + imgVal.imgUrl + "' target='_blank'><img src='<?php echo $this->cdn; ?>" + imgVal.img + "' style='width:50px;height:50px;margin-right:5px' /></a>";
                                    });
                                    html += "</div></td>";
                                    if (1 == AbnormalVal.status) {
                                        html += "<td><div><a class=\"rePreveStep\" href=\"javascript:void(0)\" rel=\"" + AbnormalKey + "\"><span>重新操作</span></a></div></td>";
                                    }

                                    html += "</tr>";
                                }
                                html += "<tr class='AbnormalDispose" + AbnormalKey + " abnormalTr'><td>处理异常：</td><td colspan='4'><div style='width:100%;float:left;'>";
                                if (AbnormalVal.arrTrack) {
                                    $.each(AbnormalVal.arrTrack, function(trackKey, trackVal) {
                                        html += "<div style='width:20%;float:left;'>" + trackVal.dateCreated + "</div>";
                                        html += "<div style='width:58%;float:left;'>" + trackVal.content + "</div>";
                                        html += "<div style='width:10%;float:left;'>" + trackVal.operator + "</div>";

                                    });
                                }
                                html += "</div></td></tr>";
                            });
                        });
                    }
                    var isHasAddress = false,
                        isHasReChangeLogistics = false,
                        isHasReChangeMoney = false,
                        isHasReissueLogistics = false,
                        isReturnMoney = false;
                    if (data.reChangItem != "") {
                        $.each(data.reChangItem, function(reChangeKey, reChangeVal) {
                            if (reChangeKey == <?php echo Application_Model_Tracking::Type_Address ?> && reChangeVal != "") {
                                html += "<tr class='reChangeAddress abnormalTr'><td style='padding: 10px 0px 5px 0px;'>退换货地址：</td><td colspan='4'><div style='width:100%;float:left;padding: 10px 0px 5px 0px;'>";
                                html += "<div style='width:20%;float:left;'>" + reChangeVal.dateAdd + "</div>";
                                html += "<div style='width:58%;float:left;'>" + reChangeVal.content + "</div>";
                                html += "<div style='width:10%;float:left;'>" + reChangeVal.operator + "</div>";
                                html += "<div style='width:10%;float:left;'><a href='javascript:void(0)' class='editReChange indexa' name='address' i='" + reChangeVal.trackId + "'>修改</a></div>";
                                html += "</div></td></tr>";
                                isHasAddress = true;
                            }
                            if (reChangeKey == <?php echo Application_Model_Tracking::Type_ReChangeLogistics ?> && reChangeVal != "") {
                                html += "<tr class='reChangeAddress abnormalTr'><td style='padding: 10px 0px 5px 0px;'>物流详情（发）：</td><td colspan='4'><div style='width:100%;float:left;padding: 10px 0px 5px 0px;'>";
                                html += "<div style='width:20%;float:left;'>" + reChangeVal.dateAdd + "</div>";
                                html += "<div style='width:58%;float:left;'>" + reChangeVal.shipName + ":" + reChangeVal.content + "</div>";
                                html += "<div style='width:10%;float:left;'>" + reChangeVal.operator + "</div>";
                                html += "<div style='width:10%;float:left;'><a href='javascript:void(0)' class='editReChange indexa' name='reChangeLogistice' i='" + reChangeVal.trackId + "'>修改</a></div>";
                                html += "</div></td></tr>";
                                isHasReChangeLogistics = true;
                            }
                            if (reChangeKey == <?php echo Application_Model_Tracking::Type_ReChangeMoney ?> && reChangeVal != "") {
                                html += "<tr class='reChangeAddress'><td style='padding: 10px 0px 5px 0px;'>发货运费：</td><td colspan='4'><div style='width:100%;float:left;padding: 10px 0px 5px 0px;'>";
                                html += "<div style='width:20%;float:left;'>" + reChangeVal.dateAdd + "</div>";
                                html += "<div style='width:58%;float:left;'>" + reChangeVal.content + "元</div>";
                                html += "<div style='width:10%;float:left;'>" + reChangeVal.operator + "</div>";
                                html += "</div></td></tr>";
                                isHasReChangeMoney = true;
                            }
                            if (reChangeKey == <?php echo Application_Model_Tracking::Type_ReissueLogistics ?> && reChangeVal != "") {
                                html += "<tr class='reChangeAddress abnormalTr'><td style='padding: 10px 0px 5px 0px;'>物流详情（收）：</td><td colspan='4'><div style='width:100%;float:left;padding: 10px 0px 5px 0px;'>";
                                html += "<div style='width:20%;float:left;'>" + reChangeVal.dateAdd + "</div>";
                                html += "<div style='width:58%;float:left;'>" + reChangeVal.shipName + ":" + reChangeVal.content + "</div>";
                                html += "<div style='width:10%;float:left;'>" + reChangeVal.operator + "</div>";
                                html += "<div style='width:10%;float:left;'><a href='javascript:void(0)' class='editReChange indexa' name='reissueLogistics' i='" + reChangeVal.trackId + "'>修改</a></div>";
                                html += "</div></td></tr>";
                                isHasReissueLogistics = true;
                            }
                            if (reChangeKey == <?php echo Application_Model_Tracking::Type_ReturnMoney; ?> && reChangeVal != "") {
                                html += "<tr class='reChangeAddress abnormalTr'><td style='padding: 10px 0px 5px 0px;'>退款金额：</td><td colspan='4'><div style='width:100%;float:left;padding: 10px 0px 5px 0px;'>";
                                html += "<div style='width:20%;float:left;'>" + reChangeVal.dateAdd + "</div>";
                                html += "<div style='width:58%;float:left;'>已退款：" + reChangeVal.content + "元</div>";
                                html += "<div style='width:10%;float:left;'>" + reChangeVal.operator + "</div>";
                                html += "</div></td></tr>";
                                isReturnMoney = true;
                            }
                        });
                    }

                    html += '</table>';
                    $("#returnChangeOrderConent .wt_center .wt_type").before(html);

                    $('.rePreveStep').bind('click', rePreveStep);
                    $("#returnChangeOrderConent .wt_reContent").hide();
                    if (data.rechangeStatus == <?php echo Application_Model_Order::ReChange_Dispose; ?> && !isHasAddress) {
                        $("#returnChangeOrderConent .wt_type").show();
                        $("#returnChangeOrderConent .wt_addAddress").show();
                    } else if (data.rechangeStatus == <?php echo Application_Model_Order::ReChange_Emit; ?> && (!isHasReChangeLogistics || !isHasReChangeMoney)) {
                        $("#returnChangeOrderConent .wt_reChangeLogistics").show();
                    } else if (data.rechangeStatus == <?php echo Application_Model_Order::ReChange_Seller; ?> && (!isHasReissueLogistics || !isReturnMoney)) {
                        if (data.scheme == <?php echo Application_Model_Order::Scheme_Return; ?> || data.scheme == <?php echo Application_Model_Order::Scheme_ReturnMoney; ?>) {
                            $("#returnChangeOrderConent .wt_reChangeMoney").show();
                        } else {
                            $("#returnChangeOrderConent .wt_reissueLogistics").show();
                        }
                    }
                }
            });
            $("#addressReturnChange").val("");
            $(".houtai_overlay #orderId").val(orderId);
            $(".wt_nav ul li").removeClass("wt_on");
            $(".wt_nav ul li").hide();
            $(".wenti_box").hide();
            $("#returnChangeOrderTitle").closest("li").addClass("wt_on");
            $("#returnChangeOrderTitle").closest("li").show();
            $(".houtai_overlay").show();
            $(".tanchuang").show();
            $("#returnChangeOrderConent").show();
        });
        $(".delAbnormal").live("click", function() {
            var abnormalId = $(this).attr("name");
            var orderId = $(".houtai_overlay #orderId").val();
            confirm("您确认删除该问题吗？", function() {
                $.post("/admini/purchase/delproblem/", {"abnormalId": abnormalId}, function(data) {
                    if (data.status == 1) {
                        $(".abnormalico[name='" + orderId + "']").click();
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                });
            });
        });
        $(".editReChange").live("click", function() {
            var name = $(this).attr("name");
            var i = $(this).attr("i");
            $("#qualityId").val(i);
            $.post("/admini/purchase/editquality", {"qualityId": i}, function(data) {
                if (data) {
                    $(".wt_reContent").hide();
                    $("tr.reChangeAddress").hide();
                    if (name == "address") {
                        $(".wt_type").show();
                        $(".wt_addAddress").show();
                        if (1 >= $(".wt_addAddress").children('a').length) {
                            $(".wt_addAddress").children('a').before('<a class="wt_liuyan reback" href="javascript:void(0);" rel="address"><span>返回</span></a>')
                        }

                        $("#addressReturnChange").val(data.content);
                    } else if (name == "reChangeLogistice") {
                        $(".wt_reChangeLogistics").show();
                        var td = $(".wt_reChangeLogistics").find('.subReChangeLogistics').parent();
                        if (1 >= td.children('a').length) {
                            td.append('<a class="reback" style="display:inline-block;margin:10px 0px 0px 8px;" href="javascript:void(0)">返回</a>');
                        }
                        $("#reChangeLogistics option[value='" + data.shipId + "']").attr("selected", true);
                        $("#reChangeLogisticsNo").val(data.content);
                        $("#reChangeLogisticsMoney").val(data.money);
                    } else if (name == "reissueLogistics") {
                        $(".wt_reissueLogistics").show();
                        var td = $(".wt_reissueLogistics").find('.subReissueLogisticsNo').parent();
                        if (1 >= td.children('a').length) {
                            td.append('<a class="reback" style="display:inline-block;margin:10px 0px 0px 8px;" href="javascript:void(0)">返回</a>');
                        }
                        $("#orderReissueLogistics option[value='" + data.shipId + "']").attr("selected", true);
                        $("#orderReissueLogisticsNo").val(data.content);
                    }
                    $('.reback').bind('click', reback)
                }
            });
        });
        /**
         * 添加代购退换货的退货地址 
         */
        $("#subreturnChangeAddress").click(function() {
            var orderId = $(".houtai_overlay #orderId").val();
            var addressReturnChange = $("#addressReturnChange").val();
            var qualityId = $(".houtai_overlay #qualityId").val();
            if (addressReturnChange == "") {
                alert("退换货地址不能为空！");
                return;
            }
            $.post("/admini/purchase/addrechangeaddress", {"orderId": orderId, "addressReturnChange": addressReturnChange, "qualityId": qualityId}, function(data) {
                if (data == 1) {
                    $(".orderReturnChange[name='" + orderId + "']").click();
                } else if (data == 2) {
                    alert("退换货地址不能为空！");
                    return;
                } else {
                    alert("出现未知错误，请刷新重新操作！");
                    return;
                }
            });
        });
        /**
         * 提交代购退换货的发货物流信息 
         */
        $(".subReChangeLogistics").click(function() {
            var reChangeLogistics = $(".wt_reChangeLogistics #reChangeLogistics").val();
            var reChangeLogisticsNo = $(".wt_reChangeLogistics #reChangeLogisticsNo").val();
            var reChangeLogisticsMoney = $(".wt_reChangeLogistics #reChangeLogisticsMoney").val();
            var qualityId = $(".houtai_overlay #qualityId").val();
            var orderId = $(".houtai_overlay #orderId").val();
            if (reChangeLogisticsNo == "") {
                alert("退换货发货物流不能为空！");
                return;
            }
            if (reChangeLogisticsMoney == "" || reChangeLogisticsMoney == 0) {
                alert("退换货发货金额不能为空或为零！");
                return;
            }
            $.post("/admini/purchase/addrechangelogistics", {"orderId": orderId, "reChangeLogistics": reChangeLogistics, "reChangeLogisticsNo": reChangeLogisticsNo, "reChangeLogisticsMoney": reChangeLogisticsMoney, "qualityId": qualityId}, function(data) {
                if (data == 1) {
                    $(".orderReturnChange[name='" + orderId + "']").click();
                } else if (data == 2) {
                    alert("退换货发货物流信息和发货金额不能为空！");
                    return;
                } else {
                    alert("出现未知错误，请刷新重新操作！");
                    return;
                }
            });
        });
        /**
         * 提交代购退换货的卖家发货的物流信息 
         */
        $(".subReissueLogisticsNo").click(function() {
            var orderReissueLogistics = $("#orderReissueLogistics").val();
            var orderReissueLogisticsNo = $("#orderReissueLogisticsNo").val();
            var orderId = $(".houtai_overlay #orderId").val();
            var qualityId = $(".houtai_overlay #qualityId").val();
            if (orderReissueLogisticsNo == "") {
                alert("退换货发卖家发货的物流不能为空！");
                return;
            }
            $.post("/admini/purchase/addreissuelogistics", {"orderId": orderId, "orderReissueLogistics": orderReissueLogistics, "orderReissueLogisticsNo": orderReissueLogisticsNo, "qualityId": qualityId}, function(data) {
                if (data == 1) {
                    $(".orderReturnChange[name='" + orderId + "']").click();
                } else if (data == 2) {
                    alert("退换货卖家发货的物流信息不能为空！");
                    return;
                } else {
                    alert("出现未知错误，请刷新重新操作！");
                    return;
                }
            });
        });
        $(".subReChangeMoney").click(function() {
            var reChangeMoney = $("#reChangeMoney").val();
            var orderId = $(".houtai_overlay #orderId").val();
            if (reChangeMoney == "" || reChangeMoney <= 0) {
                alert("退款金额不能为空或小于零！");
                return;
            }
            confirm("您确认该订单退款：" + reChangeMoney + "元？", function() {
                $.post("/admini/purchase/addrechangemoney", {"orderId": orderId, "reChangeMoney": reChangeMoney}, function(data) {
                    if (data == 1) {
                        $(".orderReturnChange[name='" + orderId + "']").click();
                    } else if (data == 2) {
                        alert("退款金额不能为空或小于零！");
                        return;
                    } else {
                        alert("出现未知错误，请刷新重新操作！");
                        return;
                    }
                });
            });
        });
        /**
         * 更改受理人 
         */
        $(".editOperator").click(function() {
            var id = $(this).attr("name");
            confirm("您确定该代购的受理人更改为您？", function() {
                $.post("/admini/purchase/editoperator", {"id": id}, function(data) {
                    if (data == 1) {
                        alert("修改成功");
                        location.reload();
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                    $(".nui-msgbox-close").click();
                });
            });
        });
        $(".retanchuang").click(function() {
            $(".houtai_overlay").hide();
            $(".tanchuang").hide();
        });
        $(".nui-msgbox-close").click(function() {
            $(".houtai_overlay").hide();
            $(".tanchuang").hide();
        });
        $("#objsubmit").click(function() {
            $(".houtai_overlay").hide();
            $(".tanchuang").hide();
        });
        $(".clearSelected").click(function() {
            $("input[name='MergerCheck']").removeAttr("checked");
            $("input[name='SplitCheck']").removeAttr("checked");
        });
        $(".setoperator").click(function() {
            var userName = $(this).attr("name");
            $("#form1 #operatorname").val(userName);
            $("#form1").submit();
        });
        $(".removeset").click(function() {
            var removei = $(this).attr("i");
            $("#form1 #" + removei).val("");
            $("#form1").submit();
        });
        function accMul(arg1, arg2) {
            var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
            try {
                m += s1.split(".")[1].length
            } catch (e) {
            }
            try {
                m += s2.split(".")[1].length
            } catch (e) {
            }
            return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
        }
    });


    $(function() {
        $(".soleNo").each(function() {

            //Create a new clipboard client
            var clip = new ZeroClipboard.Client();
            ZeroClipboard.setMoviePath("/js/clip/ZeroClipboard.swf");
            clip.setHandCursor(true);
            $.bind(window, "resize", function() {
                clip.reposition();
            });
            //Glue the clipboard client to the last td in each row
            clip.glue(this);
            var tThis = this;
            //Grab the text from the parent row of the icon
            var code = $(this).text();
            var add = "南山区朗山二号路3号悠奇大厦 " + code + " 号邮箱";
            clip.setText(add);

            clip.addEventListener('complete', function() {
                $(tThis).parent().children('span').text("已复制");
                $(tThis).parent().children('span').attr("style", "padding-right: 8px;color:#c00;")
            });
        });
        $(".copyUserName").each(function() {

            //Create a new clipboard client
            var clip = new ZeroClipboard.Client();
            ZeroClipboard.setMoviePath("/js/clip/ZeroClipboard.swf");
            clip.setHandCursor(true);
            $.bind(window, "resize", function() {
                clip.reposition();
            });
            //Glue the clipboard client to the last td in each row
            clip.glue(this);
            var tThis = this;
            //Grab the text from the parent row of the icon
            var code = $(this).text();
            clip.setText(code);

            clip.addEventListener('complete', function() {
                $(tThis).parent().children('span').text("已复制");
                $(tThis).parent().children('span').attr("style", "padding-right: 8px;color:#c00;")
            });
        });
        $('.rePreveStep').bind('click', rePreveStep);
        $('.reback').bind('click', reback)
    });

    function reback() {
        var orderId = $(".houtai_overlay #orderId").val();
        $(".orderReturnChange[name='" + orderId + "']").click();
    }

    function rePreveStep(et) {
        et.stopImmediatePropagation();
        et.stopPropagation();
        var obj = $(this);
        confirm('你确定重新处理该问题？', function() {

            var rel = obj.attr('rel'),
                    oId = $(".houtai_overlay #orderId").val();
            $.post("/admini/purchase/reprevestep", {rel: rel, id: oId}, function(data) {
                if (data == 1) {
                    alert("修改成功");
                    location.reload();
                } else {
                    alert("发生未知错误，请重新操作");
                }
                $(".nui-msgbox-close").click();
                window.location.reload();
            });
        })
    }
    
    $('.setSchemeComplete').click(function(){
        var id = $(this).attr('name');
        confirm('你确定设置该订单异常已经处理完成？', function() {
            $.post("/admini/purchase/setschemecomplete", {id: id}, function(data) {
                if (data == 1) {
                    alert("修改成功");
                } else {
                    alert("发生未知错误，请重新操作");
                }
                window.location.reload();
            });
        })
    })
    function repayHandle(obj) {
        if ($(obj).attr('checked') == 'checked') {
            $('#repay').val('1');
            $("#repay-sum").removeAttr('readonly');
        } else {
            $('#repay').val('0');
            $("#repay-sum").attr('readonly', 'true');
        }   
    }
</script>

<script type="text/javascript">
    (function(win,doc){
        var s = doc.createElement("script"), h = doc.getElementsByTagName("head")[0];
        if (!win.alimamatk_show) {
            s.charset = "gbk";
            s.async = true;
            s.src = "http://a.alimama.cn/tkapi.js";
            h.insertBefore(s, h.firstChild);
        };
        var o = {
            pid: "mm_40299568_10164035_56592443",/*推广单元ID，用于区分不同的推广渠道*/
            appkey: "23380064",/*通过TOP平台申请的appkey，设置后引导成交会关联appkey*/
            unid: "",/*自定义统计字段*/
            type: "click" /* click 组件的入口标志 （使用click组件必设）*/
        };
        win.alimamatk_onload = win.alimamatk_onload || [];
        win.alimamatk_onload.push(o);
    })(window,document);
</script>
